Create a job that starts every reboot

 

1. Create a new init.d file for your app that starts and stops your app

#!/bin/sh
#
# /apps/YourApp
# init script for YourApp.
#
### BEGIN INIT INFO
# Provides: YourName
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start YourApp
# Description: YourApp Description
### END INIT INFO
#
RETVAL=0

yourapp_start() {
echo "Starting YourApp..."
logger "Starting YourApp..."
cd /apps/pms-mediaserver/
sh PMS.sh&


RETVAL=$?
}
yourapp_stop() {
echo Stopping YourApp...
#"/opt/yourapp/bin/app" stop
RETVAL=$?
}
yourapp_restart() {
echo Restarting YourApp...
#"/opt/yourapp/bin/app" restart
RETVAL=$?
}
case "$1" in
start)
pms_start
;;
stop)
pms_stop
;;
restart)
pms_restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

exit $RETVAL

 

when that is done chmod the file with x so it is executable by script (automated)

chmod 775 +x /etc/init.d/yourapp

 

Now to make it start at every reboot you have to create a symlink to the file

cd /etc/rc2.d/
ln -s /etc/init.d/yourapp S99yourapp
# the S## value says to linux which order it should start your script/app.


 

Done!

 

Posted on: Friday 13 November 2015