linux_setting_the_date

MIX and TransSECS both support setting the date/time on the system on which they are running.

This wiki page is specific to Linux but many concepts apply to other OSs. For Windows specifics see Setting the Date and Time on Windows from TransSECS Applications

To do this, the property

date.setter

must be configured in the mix.properties (MIX) or ErgoTechConfiguration.properties (TransSECS).

For example:

date.setter=sudo date

or

date.setter=sudo date -u 

If the system clock is set to UTC (many Linux systems).

On a Linux or similar system, the command to set the date is “date”. Setting the date is privileged, that is you need root permission (sudo) to set this. You can test this by running the date command from a shell. Log in as the user running the application and type:

date 101216552002.23

If the return is:

date: cannot set date: Operation not permitted
Sat Oct 12 16:55:23 MDT 2002

You do not have sufficient privileges to set the date.

Running

sudo date 101216552002.23

should prompt for a password and then set the date. However, the password prompt is a problem when running within MIX/TransSECS.

To remove the prompt edit the file /etc/sudoers and, towards the end of that file add the line:

mix ALL=(ALL) NOPASSWD: /usr/bin/date

where “mix” is the name of the user running the application.

You can also use a group name, eg

%wheel ALL=(ALL) NOPASSWD: /usr/bin/date

The %wheel is a group name, any member of that group can now run the date command without a prompt. There are more details of this approach here:

https://unix.stackexchange.com/questions/18830/how-to-run-a-specific-program-as-root-without-a-password-prompt

  • linux_setting_the_date.txt
  • Last modified: 2021/04/09 14:20
  • by wikiadmin