Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You should have a header like the one shown above. The only useful thing there is
# chkconfig: 345 25 75
345: levels 345
25,75: Decides the starting and stopping order
I thought those were plain comments...anyway is there any logic for the starting and stopping order? 25,75?
Those are start priorities...
A quick look at the chkconfig man page tells us this...
Code:
RUNLEVEL FILES
Each service which should be manageable by chkconfig needs two or more commented lines added to its init.d script. The first
line tells chkconfig what runlevels the service should be started in by default, as well as the start and stop priority levels.
If the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list. The sec-
ond line contains a description for the service, and may be extended across multiple lines with backslash continuation.
For example, random.init has these three lines:
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for \
# higher quality random number generation.
This says that the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 20, and that its
stop priority should be 80. 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.
chkconfig still doesn't accept...here is how the script looks now:
Code:
#!/bin/bash
# language tool service script
# chkconfig: 345 20 80
# desc: service to start the language tool grammar check java program
# /etc/init.d/languagetool
case "$1" in
start)
echo -e "Starting languagetool service\n"
#To run it as root:
/var/www/html/languagetool/languagetool.sh
;;
stop)
echo -e "Stopping languagetool\n"
#To run it as root:
#/path/to/command/to/stop/languagetool
#Or to run it as some other user:
#/bin/su - username -c /path/to/command/to/stop/languagetool
#echo "."
kill `ps -ef | grep 'java -cp' | grep -v grep | awk '{ print $2 }'`
;;
*)
echo "Usage: /sbin/service languagetool {start|stop}"
exit 1
esac
exit 0
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.