How to run scripts on start up

Add your executable script at

sudo nano /etc/rc.local

It should look like this:

#!/bin/sh -e
# rc.local

echo "Kim rc.local is executed successfully" > /tmp/rc.local-started.log
sleep 3
bash /your/program/directory/ >> /tmp/auto-start-kim.log 2>&1 &

exit 0

0 = Standard input
1 = standard output
2 = standard error output

“2>&1” simply points everything sent to stderr(2), to stdout(1) instead.

Leave a Comment

Your email address will not be published. Required fields are marked *