You are not logged in.
I have tested now several versions
Version 1
head central_sync
#!/bin/bash
# synchronise Unlimited number of directories on different hosts
...
central_sync is a hardlink to /usr/local/bin/central_sync.bash
version 2
cat central_sync2
#!/bin/sh
set
/bin/bash /usr/local/bin/central_sync.bash
exit 0
version 3
cat central_sync3
#!/bin/sh
set
/bin/bash -x /usr/local/bin/central_sync.bash
exit 0
version 4
cat central_sync4
#!/bin/sh
set
/bin/bash --posix /usr/local/bin/central_sync.bash
exit 0
They all produce in the protocol log:
...
set
...
SHELL=/bin/sh
Consequently the program fails, which runs when called in the console/terminal
Parameter expansion fails in the rsync command
Last edited by bai4Iej2need (2024-10-28 10:44:29)
The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390
Offline
I'm confused... perhaps because I don't know what "the protocol log" is or may be because you do not say if the log is produced when /etc/cron.hourly/somejob runs or when you start central_sync.bash manually
If I remember this correctly, cron does not know the environment you use in the terminal. That may explain the difference you observe, and possibly the parameter expansion problem.
Prove to yourself that /etc/cron.hourly/somejob is executable and that cron actually starts it. Study the output from set. Move on to locate what fails in /etc/cron.hourly/somejob
--
OddS
Last edited by OddS (2024-10-19 09:30:19)
Offline
Hi
I failed to explain that I have a protocol function in the script which writes to /var/log/somejob/somejob.log, if executed as root.
I verified now that the script starts indeed as a dash script instead of starting as bash. Some command inside requires a bashism and then the script fails.
Works as root !
I correct now the headline as well.
Last edited by bai4Iej2need (2024-10-28 11:20:23)
The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390
Offline
It is not possible to set the shell for a particular task in /etc/cron.hourly, etc/cron.daily, etc/cron.weekly and /etc/cron.monthly.
Setting shell for all jobs is in /etc/default/cron.
I moved the job into the crontab (crontab -e) of root.
Now we go to the next problem.
The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390
Offline