Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 4148  / 2 Years ago, mon, january 31, 2022, 12:55:40

If I want to add lines to my system's /etc/crontab, what do I have to do to get them to take effect?






Background:



I'm trying to set up a machine with Ubuntu 13.04 so that it automatically locks/unlocks the monitor during the workday (it's hanging on the wall).



I've done this by adding the following to my /etc/crontab:



00 18  * * mon-fri myuser export DISPLAY:=0 && gnome-screensaver-command -a
00 18 * * mon-fri myuser export DISPLAY:=0 && xset dpms force standby
00 08 * * mon-fri myuser export DISPLAY:=0 && gnome-screensaver-command -d
00 08 * * mon-fri myuser export DISPLAY:=0 && xset dpms force on


The individual commands work fine, but I'm trying to test the crontab entries by setting the minute/day to the upcoming minute. For example, at 1:26PM I set the first two columns to 27 13 and waited until the next minute rolled around. But the commands don't appear to be getting executed. I also tried running sudo crontab /etc/crontab, but it doesn't seem to help.


More From » cron

 Answers
1

Upon further debugging, I've determined that running sudo crontab /etc/crontab is actually reloading the crontab and my commands are being run. Looks like it's just a problem with the specific commands. I was able to determine this by adding echo "test" >> /home/myuser/test.txt && to the beginning of the command.


[#28153] Tuesday, February 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cklaceowne

Total Points: 228
Total Questions: 102
Total Answers: 111

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;