my crontab looks like this:
@reboot sh /home/pi/LCDinterface/shutdownlauncher.sh 2>&1 | tee -a /home/cronlog
Content of shutdownlauncher.sh
:
cd /
cd home/pi/LCDinterface
date
python shutdown.py
echo ''
cd /
Content of shutdown.py
:
if interrupt_happens:
print ("shutting down")
time.sleep(3)
os.system("sudo shutdown -h now")
If I run python shutdown.py
or sh shutdownlauncher.sh
I can always see the output text 'shutting down' in my terminal. But If only cron starts running the bash script, which calls the python script. I never see the text, and it does not appear in the log. The date
command in sh script appears in my log, but not in the terminal. Can you help me with that? How to edit the shutdownlauncher.sh
or the cron job to see the outputs in the terminal, and in the log too? This whole thing runs on a Raspberry Pi 3, I am connected on SSH.
Content of my log file:
Fri Apr 7 19:26:33 CEST 2017
Fri Apr 7 19:36:11 CEST 2017
Fri Apr 7 21:18:45 CEST 2017
Sat Apr 8 00:08:09 CEST 2017
Sat Apr 8 00:29:31 CEST 2017
Sat Apr 8 10:08:17 CEST 2017
Sat Apr 8 11:58:35 CEST 2017
shutdown
on boot? A@reboot
cron-job runs when the machine is booting up.