Originally Posted by Mr. C.
Why not use ntpdate? Do you need to reinvent the wheel?
Setting the time in Unix/Linux requires administrative permission. You can use sudo and setup a proper sudoers configuration to allow your program's user to set the clock.
Thanks for your advice
I would like to try the SUDO option. I changed my date command to:
system("sudo date-s" + t)
I have changed ownership of my set_client.py code file to root.
Now I need to set it up to run every 30 minutes using cron/crontab or whatever.
There are so many folders with the word cron in them I don't know which to edit. I know how to use nano to edit the cron files.
I would like the program to run every 30 minutes and be initiated also upon reboot.
I edited /etc/crontabs using nano and inserted this line:
*/30 * * * * root /home/kevin/set_client.py
This is not working for me can anyone tell me which cron location to use and what the command line should look like.