Author Topic: Start Program from CronJob  (Read 97 times)

0 Members and 1 Guest are viewing this topic.

branx86

  • Administrator
  • Sr. Member
  • *****
  • Posts: 251
  • Karma: +0/-0
    • View Profile
    • cBrandon
Start Program from CronJob
« on: July 13, 2020, 12:07:45 PM »
1. Create script nano WhateverNameyouChoose.sh
2. #!/bin/sh
# launcher.sh
# navigate to home directory, then to this directory, then execute python script, then back home

cd /
cd home/pi/bbt
sudo python bbt.py
cd /

3.Make script an executable: chmod 755 WhateverNameyouChoose.sh
4. crontab is a background (daemon) process that lets you execute scripts at specific times.
   sudo crontab -e
  To make script start at reboot: @reboot sh /home/pi/WhateverNameyouChoose.sh >/home/pi/logs/cronlog 2>&1

reboot should be working.