Menu

Monday, April 9, 2012

Steps To Create A Startup Script

Steps to create a startup script

Step1:  Create a file
$ touch /etc/init.d/jira

Step2: Use your favorite editor ( eg: vi ) and past the below content into the file


#!/bin/sh

case "$1" in

start)
/opt/jira/startup.sh
;;

stop)
/opt/jira/stop
ps aux | grep java
CSTOP=`echo $?`

if [ $CSTOP = 0 ]; then
sudo killall java
else

echo " Application is stopped"
fi
;;

restart)

$0 stop && sleep 5
$0 start

;;

reload)

$0 stop
$0 start
;;

*)

echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

Step3: Change the file permissions

chmod +x /etc/init.d/httpd 
Step4 : Auto Starting application


 # update-rc.d apache2 defaults
Adding system startup for /etc/init.d/apache2 ...
/etc/rc0.d/K20apache2 -> ../init.d/apache2
/etc/rc1.d/K20apache2 -> ../init.d/apache2
/etc/rc6.d/K20apache2 -> ../init.d/apache2
/etc/rc2.d/S20apache2 -> ../init.d/apache2
/etc/rc3.d/S20apache2 -> ../init.d/apache2
/etc/rc4.d/S20apache2 -> ../init.d/apache2
/etc/rc5.d/S20apache2 -> ../init.d/apache2
 


Step 5: Manual start and restart of application


 /etc/init.d/jira start 

No comments:

Post a Comment