[opensuse-support] cron only likes certain jobs
Hi, all -- I'm stuck; it's time to come to the experts for help :-) I have a 15.1 live system jpo:~ # cat /etc/SUSE-brand openSUSE VERSION = 15.1 jpo:~ # df -kh / /dev/sdi[13] Filesystem Size Used Avail Use% Mounted on LiveOS_rootfs 14G 5.5G 7.3G 44% / /dev/sdi1 912M 912M 0 100% /run/initramfs/live /dev/sdi3 14G 5.5G 7.3G 44% /run/overlayfs that will eventually be a little server, and cron mysteriously only likes certain jobs. My (root) crontab looks like this: jpo:~ # crontab -l #mi hr dm mo dw cmd... # # is cron running? 01 * * * * date >$HOME/.cron.out # nightly cleanup/checkup 04 04 * * * /usr/local/bin/nightly.cleanup # cron tests 41 11 29 09 * /root/tmp-touch-root 41 11 29 09 * /usr/local/bin/tmp-touch-local 41 11 29 09 * /mnt/Raid1md/tmp-touch-Raid1 It quite happily runs the hourly heartbeat and the nightly cleanup jpo:~ # ls -l ~/.cron.out /mnt/Raid1md/cleanup/.find-print -rw-rw---- 1 root root 625767441 Sep 27 05:53 /mnt/Raid1md/cleanup/.find-print -rw-r--r-- 1 root root 29 Sep 28 22:01 /root/.cron.out but I can't for the life of me get it to run other scripts. This started as a problem with just a single sync script running from the /mnt/Raid1md volume, but I've simplified it from there. None of the three touch scripts listed above works! I set up runs for 11:41 and then waited, but I got no results. jpo:~ # date Tue Sep 29 11:40:13 UTC 2020 jpo:~ # ls -l /root/tmp-touch-root /usr/local/bin/tmp-touch-local /mnt/Raid1md/tmp-touch-Raid1 -rwxr-xr-x 1 root root 33 Sep 29 11:39 /mnt/Raid1md/tmp-touch-Raid1 -rwxr-xr-x 1 root root 32 Sep 29 11:38 /root/tmp-touch-root -rwxr-xr-x 1 root root 33 Sep 29 11:39 /usr/local/bin/tmp-touch-local jpo:~ # tail /root/tmp-touch-root /usr/local/bin/tmp-touch-local /mnt/Raid1md/tmp-touch-Raid1 ==> /root/tmp-touch-root <== #!/bin/sh touch /tmp/touch-root ==> /usr/local/bin/tmp-touch-local <== #!/bin/sh touch /tmp/touch-local ==> /mnt/Raid1md/tmp-touch-Raid1 <== #!/bin/sh touch /tmp/touch-Raid1 jpo:~ # date Tue Sep 29 11:41:18 UTC 2020 jpo:~ # ls -l /tmp/touch* ls: cannot access '/tmp/touch*': No such file or directory The crazy thing, though, is that the scripts get called ... I have also stopped crond and manually restarted it with debugging jpo:~ # ps aguxw | egrep '[/]cron' root 16821 0.0 0.0 18580 2968 pts/24 S+ Sep28 0:00 /usr/sbin/cron -n -m off -x ext,sch,proc,pars,load,misc,test,bit so that I could watch what's going on. Sure enough, I *do* see those processes being kicked off: load_entry()...about to parse command linenum=317 load_entry()...returning successfully ...load_user() done unlinking old database: check_inotify_database is done user [root:0:0:...] cmd="/mnt/Raid1md/tmp-touch-Raid1" user [root:0:0:...] cmd="/usr/local/bin/tmp-touch-local" user [root:0:0:...] cmd="/root/tmp-touch-root" [16821] do_command(/mnt/Raid1md/tmp-touch-Raid1, (root,0,0)) [16821] main process returning to work [16821] do_command(/usr/local/bin/tmp-touch-local, (root,0,0)) [16821] main process returning to work [16821] do_command(/root/tmp-touch-root, (root,0,0)) [16821] main process returning to work [16821] Target time=1601379720, sec-to-wait=60 [29186] child_process('/usr/local/bin/tmp-touch-local') [29186] child continues, closing pipes [29186] child reading output from grandchild [29188] grandchild process fork()'ed log_it: (root 29188) CMD (/usr/local/bin/tmp-touch-local) [29186] got data (64:d) from grandchild [29186] got EOF from grandchild [29186] waiting for grandchild #2 to finish [29187] child_process('/root/tmp-touch-root') [29186] grandchild #29188 finished, status=0000 [29186] waiting for grandchild #1 to finish [29186] no more grandchildren--mail written? [29187] child continues, closing pipes [29187] child reading output from grandchild [29186] child process done, exiting [29189] grandchild process fork()'ed log_it: (root 29189) CMD (/root/tmp-touch-root) [29187] got data (64:d) from grandchild [16821] sigchld...pid #29186 died, stat=0 [16821] sigchld...no dead kids [29185] child_process('/mnt/Raid1md/tmp-touch-Raid1') [29187] got EOF from grandchild [29187] waiting for grandchild #2 to finish [29187] grandchild #29189 finished, status=0000 [29187] waiting for grandchild #1 to finish [29187] no more grandchildren--mail written? [29185] child continues, closing pipes [29185] child reading output from grandchild [29190] grandchild process fork()'ed [29187] child process done, exiting log_it: (root 29190) CMD (/mnt/Raid1md/tmp-touch-Raid1) [29185] got data (64:d) from grandchild [16821] sigchld...pid #29187 died, stat=0 [16821] sigchld...no dead kids [29185] got EOF from grandchild [29185] waiting for grandchild #2 to finish [29185] grandchild #29190 finished, status=0000 [29185] waiting for grandchild #1 to finish [29185] no more grandchildren--mail written? [29185] child process done, exiting [16821] sigchld...pid #29185 died, stat=0 [16821] sigchld...no children Each one started, and each one finished with a clean exit status, but nothing actually ran. WTF?!? I originally thought there was a noexec problem on /mnt/Raid1md, but it also doesn't work from /usr/local where the cleanup script DOES work, so that's out. And if cron can find date in its path then touch should jpo:~ # which date touch /usr/bin/date /usr/bin/touch be just fine, too. Soooooo ... Before I go and hunt down the proper jpo:~ # rpm -qa | grep cron cronie-1.5.1-lp151.4.6.1.x86_64 cron-4.2-lp151.4.6.1.x86_64 (no, I have no idea what's up there, but it's the same davidtg@gezebel:~> rpm -qa | grep cron cron-4.2-lp151.4.6.1.x86_64 cronie-1.5.1-lp151.4.6.1.x86_64 on my "real install" system) cron mailing list, does anyone here have any ideas for me? TIA as always & HAND :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
* David T-G <davidtg-robot@justpickone.org> [09-29-20 08:06]:
Hi, all --
I'm stuck; it's time to come to the experts for help :-) I have a 15.1 live system
jpo:~ # cat /etc/SUSE-brand openSUSE VERSION = 15.1
jpo:~ # df -kh / /dev/sdi[13] Filesystem Size Used Avail Use% Mounted on LiveOS_rootfs 14G 5.5G 7.3G 44% / /dev/sdi1 912M 912M 0 100% /run/initramfs/live /dev/sdi3 14G 5.5G 7.3G 44% /run/overlayfs
that will eventually be a little server, and cron mysteriously only likes certain jobs. My (root) crontab looks like this:
jpo:~ # crontab -l #mi hr dm mo dw cmd... # # is cron running? 01 * * * * date >$HOME/.cron.out # nightly cleanup/checkup 04 04 * * * /usr/local/bin/nightly.cleanup # cron tests 41 11 29 09 * /root/tmp-touch-root 41 11 29 09 * /usr/local/bin/tmp-touch-local 41 11 29 09 * /mnt/Raid1md/tmp-touch-Raid1
It quite happily runs the hourly heartbeat and the nightly cleanup
jpo:~ # ls -l ~/.cron.out /mnt/Raid1md/cleanup/.find-print -rw-rw---- 1 root root 625767441 Sep 27 05:53 /mnt/Raid1md/cleanup/.find-print -rw-r--r-- 1 root root 29 Sep 28 22:01 /root/.cron.out
but I can't for the life of me get it to run other scripts. This started as a problem with just a single sync script running from the /mnt/Raid1md volume, but I've simplified it from there. None of the three touch scripts listed above works!
I set up runs for 11:41 and then waited, but I got no results.
jpo:~ # date Tue Sep 29 11:40:13 UTC 2020 jpo:~ # ls -l /root/tmp-touch-root /usr/local/bin/tmp-touch-local /mnt/Raid1md/tmp-touch-Raid1 -rwxr-xr-x 1 root root 33 Sep 29 11:39 /mnt/Raid1md/tmp-touch-Raid1 [...]
(no, I have no idea what's up there, but it's the same
davidtg@gezebel:~> rpm -qa | grep cron cron-4.2-lp151.4.6.1.x86_64 cronie-1.5.1-lp151.4.6.1.x86_64
on my "real install" system) cron mailing list, does anyone here have any ideas for me?
try running them: 41 11 29 09 * /usr/bin/bash /root/tmp-touch-root 41 11 29 09 * /usr/bin/bash /usr/local/bin/tmp-touch-local 41 11 29 09 * /usr/bin/bash /mnt/Raid1md/tmp-touch-Raid1 or "/usr/bin/sh" memory serves, sometimes this is necessary, but do not remember why. gud luk, -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri Photos: http://wahoo.no-ip.org/piwigo paka @ IRCnet freenode -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On 29/09/2020 14.04, David T-G wrote:
Hi, all --
I'm stuck; it's time to come to the experts for help :-) I have a 15.1 live system
jpo:~ # cat /etc/SUSE-brand openSUSE VERSION = 15.1
jpo:~ # df -kh / /dev/sdi[13] Filesystem Size Used Avail Use% Mounted on LiveOS_rootfs 14G 5.5G 7.3G 44% / /dev/sdi1 912M 912M 0 100% /run/initramfs/live /dev/sdi3 14G 5.5G 7.3G 44% /run/overlayfs
I have never experimented with cron on a live system.
that will eventually be a little server, and cron mysteriously only likes certain jobs. My (root) crontab looks like this:
jpo:~ # crontab -l #mi hr dm mo dw cmd... # # is cron running? 01 * * * * date >$HOME/.cron.out
I assume that you are actually root, thus $HOME points to /root/? I don't have more ideas this minute, sorry. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
Am Dienstag, 29. September 2020, 14:04:48 CEST schrieb David T-G:
==> /root/tmp-touch-root <== #!/bin/sh touch /tmp/touch-root
==> /usr/local/bin/tmp-touch-local <== #!/bin/sh touch /tmp/touch-local
==> /mnt/Raid1md/tmp-touch-Raid1 <== #!/bin/sh touch /tmp/touch-Raid1
cron does not provide a search path in the environment its jobs are run. In the scripts you want to run via cron, use full path names for commands: ==> /root/tmp-touch-root <== #!/bin/sh /usr/bintouch /tmp/touch-root HTH /Andreas -- Time flies like an arrow. Fruit flies like a banana. -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On Sat, 03 Oct 2020 07:12:17 +0200 Andreas Mahel <andreas@mahel.net> wrote:
Am Dienstag, 29. September 2020, 14:04:48 CEST schrieb David T-G:
==> /root/tmp-touch-root <== #!/bin/sh touch /tmp/touch-root
==> /usr/local/bin/tmp-touch-local <== #!/bin/sh touch /tmp/touch-local
==> /mnt/Raid1md/tmp-touch-Raid1 <== #!/bin/sh touch /tmp/touch-Raid1
cron does not provide a search path in the environment its jobs are run.
Not correct. For a normal user it is /usr/bin:/bin and for the system it includes sbin. But you can always set it yourself in the crontab file anyway: PATH=/whatever/you/want:but/no/variable/paths
In the scripts you want to run via cron, use full path names for commands: ==> /root/tmp-touch-root <== #!/bin/sh /usr/bintouch /tmp/touch-root
And all irrelevant anyway since David did use full paths.
HTH /Andreas -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
participants (5)
-
Andreas Mahel
-
Carlos E. R.
-
Dave Howorth
-
David T-G
-
Patrick Shanahan