Adding a Start/Stop Script to chkconfig
In order to add a script to be manageable by chkconfig, you should create the /etc/init.d/example script that has the ability to start and stop script.
Now put the following two comments around the header of the script
# chkconfig: 345 80 20<br></br>
# description: Sample Description \<br></br>
# Sample multiline description.```
This says that the random script should be started in levels 3, 4, and 5, that its start priority should be 80, and that its
stop priority should be 20. You should be able to figure out what the description says; the \ causes the line to be continued.
The extra space in front of the line is ignored.
!/bin/bash
language tool service script
chkconfig: 345 20 80
desc: service to start the language tool grammar check java program```
/etc/init.d/sample
case "$1" in
start)
echo -e "Starting Sample service\n"
/path/to/sample.sh
;;
stop)
echo -e "Stopping Sample Service\n"
kill ps -ef | grep 'sample.sh' | grep -v grep | awk '{ print $2 }'
;;
*)
echo "Usage: /sbin/service sampleservice {start|stop}"
exit 1
esac
exit 0