startup
linux startup
Adding commands at startup
Write a script placing it at /etc/init.d/
#! /bin/sh
# /etc/init.d/myautostart
### BEGIN INIT INFO
# Provides: myautostart
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: My autostart actions
# Description: My autostart actions
### END INIT INFO
case "$1" in
start)
echo "Starting myautostart..."
# execute a script in my home folder
/home/myuser/myscript.sh
;;
stop)
echo "Stopping myautostart..."
# do something
;;
*)
echo "Usage: /etc/init.d/myautostart {start|stop}"
exit 1
;;
esac
exit 0Make it executable
Test it on start and on stop
Add the script on startup
Last updated