Sorry if this is a bit long, but I wanted to give as much information as I could and hope someone can help.
On a new installation of Kubuntu 22.04, cron jobs are not running and this is driving me crazy.
The cron daemon is running
shoshana@shoshana:~/Desktop$ pgrep cron 827
I thought there might be a problem with a specific job so I created the following simple script (which DOES work).
shoshana@shoshana:~/Desktop$ cat tstrun #!/usr/bin/sh cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
If I do: cd /home/shoshana/Desktop ./tstrun the script works and I see aaaa in tst.txt
I then deleted ALL jobs in crontab and added only the following to /etc/crontab */1 * * * * root /home/shoshana/Desktop/tstrun
Nothing happens - nothing written in tst.txt
I tried: sudo grep CRON /var/log/syslog and got no output
I changed the script to: #!/usr/bin/sh echo "test echo from tstrun" cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
and changed the crontab line to: */1 * * * * root /home/shoshana/Desktop/tstrun >> /home/shoshana/Desktop/tstrun-log.txt
still no output in tst.txt and also no output in /home/shoshana/Desktop/tstrun-log.txt
And as expected, if I do: ./tstrun >> tstrun-log.txt I see the expected output in both files
I also tried: shoshana@shoshana:~/Desktop$ sudo service cron stop shoshana@shoshana:~/Desktop$ sudo service cron start shoshana@shoshana:~/Desktop$ pgrep cron 3377
AND shoshana@shoshana:~/Desktop$ sudo systemctl stop cron shoshana@shoshana:~/Desktop$ sudo systemctl start cron shoshana@shoshana:~/Desktop$ pgrep cron 3413
But still no change.
And just to be clear, on a different machine (also Kubuntu 22.04) all the above DOES work - output to both files and if I do: sudo grep CRON /var/log/syslog I get: Feb 7 17:13:01 solomon-laptop CRON[16619]: (root) CMD (/home/solomon/Desktop/tstrun)
Try to remove the word "root" אורי uri@speedy.net
On Wed, Feb 7, 2024 at 5:18 PM Shlomo Solomon shlomo.solomon@gmail.com wrote:
Sorry if this is a bit long, but I wanted to give as much information as I could and hope someone can help.
On a new installation of Kubuntu 22.04, cron jobs are not running and this is driving me crazy.
The cron daemon is running
shoshana@shoshana:~/Desktop$ pgrep cron 827
I thought there might be a problem with a specific job so I created the following simple script (which DOES work).
shoshana@shoshana:~/Desktop$ cat tstrun #!/usr/bin/sh cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
If I do: cd /home/shoshana/Desktop ./tstrun the script works and I see aaaa in tst.txt
I then deleted ALL jobs in crontab and added only the following to /etc/crontab */1 * * * * root /home/shoshana/Desktop/tstrun
Nothing happens - nothing written in tst.txt
I tried: sudo grep CRON /var/log/syslog and got no output
I changed the script to: #!/usr/bin/sh echo "test echo from tstrun" cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
and changed the crontab line to: */1 * * * * root /home/shoshana/Desktop/tstrun >> /home/shoshana/Desktop/tstrun-log.txt
still no output in tst.txt and also no output in /home/shoshana/Desktop/tstrun-log.txt
And as expected, if I do: ./tstrun >> tstrun-log.txt I see the expected output in both files
I also tried: shoshana@shoshana:~/Desktop$ sudo service cron stop shoshana@shoshana:~/Desktop$ sudo service cron start shoshana@shoshana:~/Desktop$ pgrep cron 3377
AND shoshana@shoshana:~/Desktop$ sudo systemctl stop cron shoshana@shoshana:~/Desktop$ sudo systemctl start cron shoshana@shoshana:~/Desktop$ pgrep cron 3413
But still no change.
And just to be clear, on a different machine (also Kubuntu 22.04) all the above DOES work - output to both files and if I do: sudo grep CRON /var/log/syslog I get: Feb 7 17:13:01 solomon-laptop CRON[16619]: (root) CMD (/home/solomon/Desktop/tstrun)
-- Shlomo Solomon http://the-solomons.net Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04 _______________________________________________ Linux-il mailing list -- linux-il@cs.huji.ac.il To unsubscribe send an email to linux-il-leave@cs.huji.ac.il
No - that did not change anything and, in any case, as I wrote, that exact line (including root) works on another Kubuntu 22.04 machine.
It also worked on Kubuntu 20.04 before I did a new install of 22.04
On Wed, 7 Feb 2024 17:41:05 +0200 אורי uri@speedy.net wrote:
Try to remove the word "root" אורי uri@speedy.net
On Wed, Feb 7, 2024 at 5:18 PM Shlomo Solomon shlomo.solomon@gmail.com wrote:
Sorry if this is a bit long, but I wanted to give as much information as I could and hope someone can help.
On a new installation of Kubuntu 22.04, cron jobs are not running and this is driving me crazy.
The cron daemon is running
shoshana@shoshana:~/Desktop$ pgrep cron 827
I thought there might be a problem with a specific job so I created the following simple script (which DOES work).
shoshana@shoshana:~/Desktop$ cat tstrun #!/usr/bin/sh cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
If I do: cd /home/shoshana/Desktop ./tstrun the script works and I see aaaa in tst.txt
I then deleted ALL jobs in crontab and added only the following to /etc/crontab */1 * * * * root /home/shoshana/Desktop/tstrun
Nothing happens - nothing written in tst.txt
I tried: sudo grep CRON /var/log/syslog and got no output
I changed the script to: #!/usr/bin/sh echo "test echo from tstrun" cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
and changed the crontab line to: */1 * * * * root /home/shoshana/Desktop/tstrun >> /home/shoshana/Desktop/tstrun-log.txt
still no output in tst.txt and also no output in /home/shoshana/Desktop/tstrun-log.txt
And as expected, if I do: ./tstrun >> tstrun-log.txt I see the expected output in both files
I also tried: shoshana@shoshana:~/Desktop$ sudo service cron stop shoshana@shoshana:~/Desktop$ sudo service cron start shoshana@shoshana:~/Desktop$ pgrep cron 3377
AND shoshana@shoshana:~/Desktop$ sudo systemctl stop cron shoshana@shoshana:~/Desktop$ sudo systemctl start cron shoshana@shoshana:~/Desktop$ pgrep cron 3413
But still no change.
And just to be clear, on a different machine (also Kubuntu 22.04) all the above DOES work - output to both files and if I do: sudo grep CRON /var/log/syslog I get: Feb 7 17:13:01 solomon-laptop CRON[16619]: (root) CMD (/home/solomon/Desktop/tstrun)
-- Shlomo Solomon http://the-solomons.net Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04 _______________________________________________ Linux-il mailing list -- linux-il@cs.huji.ac.il To unsubscribe send an email to linux-il-leave@cs.huji.ac.il
If I had to hazard a guess, it has something to do with systemd (the usual suspect)
What does `|sudo systemctl status cron` return?
If that shows the service being disabled or stopped, you'll of course need to run `||sudo systemctl enable cron` to get it going at every boot and |`|sudo systemctl start cron||` to start it immediately
|On 07-Feb-24 11:23, Shlomo Solomon wrote:
No - that did not change anything and, in any case, as I wrote, that exact line (including root) works on another Kubuntu 22.04 machine.
It also worked on Kubuntu 20.04 before I did a new install of 22.04
On Wed, 7 Feb 2024 17:41:05 +0200 אוריuri@speedy.net wrote:
Try to remove the word "root" אורי uri@speedy.net
On Wed, Feb 7, 2024 at 5:18 PM Shlomo Solomon shlomo.solomon@gmail.com wrote:
Sorry if this is a bit long, but I wanted to give as much information as I could and hope someone can help.
On a new installation of Kubuntu 22.04, cron jobs are not running and this is driving me crazy.
The cron daemon is running
shoshana@shoshana:~/Desktop$ pgrep cron 827
I thought there might be a problem with a specific job so I created the following simple script (which DOES work).
shoshana@shoshana:~/Desktop$ cat tstrun #!/usr/bin/sh cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
If I do: cd /home/shoshana/Desktop ./tstrun the script works and I see aaaa in tst.txt
I then deleted ALL jobs in crontab and added only the following to /etc/crontab */1 * * * * root /home/shoshana/Desktop/tstrun
Nothing happens - nothing written in tst.txt
I tried: sudo grep CRON /var/log/syslog and got no output
I changed the script to: #!/usr/bin/sh echo "test echo from tstrun" cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
and changed the crontab line to: */1 * * * * root /home/shoshana/Desktop/tstrun >> /home/shoshana/Desktop/tstrun-log.txt
still no output in tst.txt and also no output in /home/shoshana/Desktop/tstrun-log.txt
And as expected, if I do: ./tstrun >> tstrun-log.txt I see the expected output in both files
I also tried: shoshana@shoshana:~/Desktop$ sudo service cron stop shoshana@shoshana:~/Desktop$ sudo service cron start shoshana@shoshana:~/Desktop$ pgrep cron 3377
AND shoshana@shoshana:~/Desktop$ sudo systemctl stop cron shoshana@shoshana:~/Desktop$ sudo systemctl start cron shoshana@shoshana:~/Desktop$ pgrep cron 3413
But still no change.
And just to be clear, on a different machine (also Kubuntu 22.04) all the above DOES work - output to both files and if I do: sudo grep CRON /var/log/syslog I get: Feb 7 17:13:01 solomon-laptop CRON[16619]: (root) CMD (/home/solomon/Desktop/tstrun)
-- Shlomo Solomon http://the-solomons.net Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04 _______________________________________________ Linux-il mailing list --linux-il@cs.huji.ac.il To unsubscribe send an email tolinux-il-leave@cs.huji.ac.il
THANK YOU !!!!!!!! Your guess was wrong, but sudo systemctl status cron (which I did not think of before) helped me find the problem. The service WAS running, but the output of that command showed that the owner of /etc/crontab was not root.
A stupid mistake on my part - I copied the file from another computer and did not change the owner. But I would not have found the error without your help, so again - THANK YOU !!!!!
On Wed, 7 Feb 2024 11:43:46 -0500 "Mark E. Fuller" mark.e.fuller@gmail.com wrote:
If I had to hazard a guess, it has something to do with systemd (the usual suspect)
What does `|sudo systemctl status cron` return?
If that shows the service being disabled or stopped, you'll of course need to run `||sudo systemctl enable cron` to get it going at every boot and |`|sudo systemctl start cron||` to start it immediately
|On 07-Feb-24 11:23, Shlomo Solomon wrote:
No - that did not change anything and, in any case, as I wrote, that exact line (including root) works on another Kubuntu 22.04 machine.
It also worked on Kubuntu 20.04 before I did a new install of 22.04
On Wed, 7 Feb 2024 17:41:05 +0200 אוריuri@speedy.net wrote:
Try to remove the word "root" אורי uri@speedy.net
On Wed, Feb 7, 2024 at 5:18 PM Shlomo Solomon shlomo.solomon@gmail.com wrote:
Sorry if this is a bit long, but I wanted to give as much information as I could and hope someone can help.
On a new installation of Kubuntu 22.04, cron jobs are not running and this is driving me crazy.
The cron daemon is running
shoshana@shoshana:~/Desktop$ pgrep cron 827
I thought there might be a problem with a specific job so I created the following simple script (which DOES work).
shoshana@shoshana:~/Desktop$ cat tstrun #!/usr/bin/sh cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
If I do: cd /home/shoshana/Desktop ./tstrun the script works and I see aaaa in tst.txt
I then deleted ALL jobs in crontab and added only the following to /etc/crontab */1 * * * * root /home/shoshana/Desktop/tstrun
Nothing happens - nothing written in tst.txt
I tried: sudo grep CRON /var/log/syslog and got no output
I changed the script to: #!/usr/bin/sh echo "test echo from tstrun" cd /home/shoshana/Desktop echo "aaaa" >> tst.txt
and changed the crontab line to: */1 * * * * root /home/shoshana/Desktop/tstrun >> /home/shoshana/Desktop/tstrun-log.txt
still no output in tst.txt and also no output in /home/shoshana/Desktop/tstrun-log.txt
And as expected, if I do: ./tstrun >> tstrun-log.txt I see the expected output in both files
I also tried: shoshana@shoshana:~/Desktop$ sudo service cron stop shoshana@shoshana:~/Desktop$ sudo service cron start shoshana@shoshana:~/Desktop$ pgrep cron 3377
AND shoshana@shoshana:~/Desktop$ sudo systemctl stop cron shoshana@shoshana:~/Desktop$ sudo systemctl start cron shoshana@shoshana:~/Desktop$ pgrep cron 3413
But still no change.
And just to be clear, on a different machine (also Kubuntu 22.04) all the above DOES work - output to both files and if I do: sudo grep CRON /var/log/syslog I get: Feb 7 17:13:01 solomon-laptop CRON[16619]: (root) CMD (/home/solomon/Desktop/tstrun)
-- Shlomo Solomon http://the-solomons.net Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04 _______________________________________________ Linux-il mailing list --linux-il@cs.huji.ac.il To unsubscribe send an email tolinux-il-leave@cs.huji.ac.il
On Wed, Feb 7, 2024 at 6:44 PM Mark E. Fuller mark.e.fuller@gmail.com wrote:
need to run `sudo systemctl enable cron` to get it going at every boot and `sudo systemctl start cron` to start it immediately
Or better, 'sudo systemctl enable --now cron', which does both actions in one command. ditto for 'disable' / stop.
P.S. I know the OP's issue has been resolved, this is for future Googlers...