News:

The Latest electronic and computer Tips that work!

Main Menu

Create a crontab startup script

Started by branx86, November 04, 2019, 10:44:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

1. Create script nano WhateverNameyouChoose.sh
2. Put the text below in the top of the script:
#!/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.