I run a shell script at reboot, by having it in my crontab:
@daily apt-get update && apt-get upgrade -y
@reboot bash /root/Start.sh
@reboot /bin/bash -c 'sleep 10 && /bin/mount -a'
...
The shell script is executed, since it launches other .py-scripts successfully, but it does not launch all scripts (all except trouble.py) from within.
However, when I run the shell script myself, with:
bash Start.sh
all scripts within the .sh are executed.
This is my shell-script:
sleep 15
python3 /root/.../trouble.py > /root/error_log_bash.txt
python3 /root/.../working1.py &
python3 /root/.../working2.py &
I've tried so far:
- to change the order within the .sh
- different amounts of sleep before and after
- chmod +x the .py script
- to launch another similar script instead, which works as expected.
- to check the error_log_bash.txt, but it was empty
- sudo the launch in the .sh
Since it works with another script I was considering whether the script is the problem. However, since it works manually I find this difficult to imagine. Am I missing something? What could provoke such a behavior? I'm working on debian, as root.
#Edit @Waltinator Thank you for pointing out the differences between cron and regular env. When I run sh /root/Start.sh instead of bash /root/Start.sh with the manual console I receive no error.