Skip to content

Start script at boot

Alex Simon edited this page May 14, 2016 · 4 revisions

Create the shell script

#!/bin/sh /etc/rc.common
START=99
STOP=15

boot() {
    # launch the python script
    python my_script.py &
}

start() {        
   echo start
   # commands to launch application
}                 
 
stop() {          
   echo stop
   # commands to kill application 
}

restart() {        
    # launch the python script
    python my_script.py &
}

IMPORTANT: make sure you use absolute path to my_script.py

Move it to the correct folder

mv initScript /etc/init.d/

Give it execute permissions

chmod +x /etc/init.d/initScript

Enable it

/etc/init.d/initScript enable

List all init scrips

for F in /etc/init.d/* ; do $F enabled && echo $F on || echo $F **disabled**; done