Linux Custom Services

Source: Internet
Author: User

Imitate the contents of any file under/etc/rc.d/init.d, write a new file, name the same as your servicename name, and then execute

Chkconfig--add ServiceName

After successful execution, edit the servicename file,

For example:

#!/bin/bash# whoami# root# chkconfig:345 description:starts the JBoss deamons#jboss_home=/usr/java/jbossjboss_o Wner=rootcase "in ' Start ') echo-n" starting JBoss: "su-$JBOSS _owner-c" $JBOSS _home/bin/run.sh "&touch/var/lo Ck/subsys/jbossecho;; ' Stop ') echo-n "shutting down jboss!" su-$JBOSS _owner-c "kill-9 $ (Ps-ef | grep JBoss | grep java | awk ' {print $} ') ' rm-f/var/lock/subsys/jbossecho;; ' Restart ') echo-n "restarting JBoss:" $ stop $ startecho;; *) echo "Usage:jboss {start | Stop | Restart} "Exit 1esacexit 0


Linux Custom Services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.