Hey everyone, I am experiencing the same problem...
Wed Sep 6 12:45:00 2023 cron.err crond: USER root pid 3139 cmd /usr/stopDog.sh
Wed Sep 6 12:50:00 2023 cron.err crond: USER root pid 3153 cmd /usr/stopDog.sh
My script is unable to run, and these error messages appear in my log... What exactly is causing this problem?
did you read the whole thread ?
do you have the same problem as OP ?
Yes, I know cron.err is the default way cron logs it's messages.
Well, I guess not, since my problem is the task I mentioned not working. I will keep investigating and if I dont find a solution I will open a new topic
Based on your log extract, the script is actually started (tried to start) twice.
So, it is more likely about the script succeeding when run headless by cron.
Do you have there log output or similar, via echo ?
(can you share the script contents?)
I actually figured out what I did wrong, and I must admit, it was a dumb reason... xd
Basically, I forgot to add 'sh' to the sheduled tasks definition, like this:
*/15 * * * * sh /usr/stopDog.sh
30 4 * * * sleep 70 && touch /etc/banner && reboot
So, the script was not executing because I wasn't telling it to execute... my bad everyone
Good that you got it sorted.
But I do not think that you should need to add that 'sh'. That sounds strange, assuming that your script had a proper shebang.
By proper shebang, you mean #!/bin/sh ?
Then yes, it has the proper shebang
Are the file permissions set for executable bit?
chmod u+x /usr/stopDog.sh
Right now, x permissions are for file owner only. I'm guessing it should include more groups?
Here are the permissions for stopDog.sh
That should be enough as long as the file is owned by root user.
I think that if you are executing a script with
It does not need the execute bit set.
Alternatively set the execute bit and then you can execute with:
./myscript for executing a script from the same directory otherwise specify full path.
A file extension has no meaning in this case (it is not windows)
Can confirm, works as ./stopDog.sh
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.