CentOS6.4 install daemontools

Source: Internet
Author: User
I recently used daemontools, but found that Baidu basically has no Chinese version. I would like to share it with you. the author's English proficiency is not very good. please correct me if the translation is incorrect. 1. daemontools is a daemontools tool that monitors a process to avoid unexpected exit. for example, it monitors a java program entry in a directory, keep it running. Daemontools

I recently used daemontools, but found that Baidu basically has no Chinese version. I would like to share it with you. the author's English proficiency is not very good. please correct me if the translation is incorrect.

1. daemontools is a daemontools tool that monitors a process to avoid unexpected exit. for example, it monitors a java program entry in a directory, keep it running. The daemontools cannot use the kill command to kill the daemontools daemon. This is the design philosophy of daemontools. It includes many programs (or commands ). Svscanboot: this command is very important, but generally does not need to be manually input and executed. it is used to start the svscan command in the/service directory (see svscan, then svscan starts supvise (see supvise), and supvise runs the run script and monitors it. After the installation is successful, svscanboot is automatically executed when Linux is restarted. Svscan:Used to start the supervise process (see supervise) in all subdirectories of the Service Directory. svscan starts two supervise processes and one sub-directory. S, A sub-directory SUnder LogDirectory (if any), the program will automatically run the run script in subdirectory s at startup, monitor the processes started by the run script, and start S/logRun script, which can be used to output SRun script logs in the directory to the specified directory. For the run script in s/log, see the following example. Svscan checks the sub-directory every five seconds. if a new directory is found, it starts a new supervise process for the directory. If a directory that has already executed supervise but has exited supervise, it will restart the supervise process for this directory. Svscan is designed to run continuously. if supervise cannot be executed, it will retry every 5 seconds. Supervise:This command will execute a directory such SRun script, if the run script exists. After the script is run, if the run script exits, it will be executed again several seconds later. If S/downIf the file exists, supervise does not immediately start the run script. you can use the svc command to start it. S/superviseThe directory maintains state information in a binary format. Therefore, this directory must be writable to supervise. the svstat command can be used to read state information. When supervise cannot find the file he needs in the s directory or has a supervise running in the s Directory, supervise will not be started immediately after exiting. Once supervise runs successfully, it does not exit unless it is killed or explicitly requested. Svc: usage: [Plain]View plaincopyprint?
  1. Svc opts services
Opts is a series of parameters, services is a directory with supervise monitoring, the following are all options:
  • -U: Up. if the service is not running, start it. if the service is stopped, restart it.
  • -D: Down. if services is running, send a TERM (terminate) signal to it, and then send a CONT (continue) signal. after it is stopped, it will not start again.
  • -O: Once. if the service is not running, start it, but it is no longer started after it is stopped. Is to run only once.
  • -P: Pause, which sends a stop signal to services.
  • -C: Continue, send a CONT signal to services.
  • -H: Hang up, which sends an HUP signal to services.
  • -: Alarm, which sends an ALRM signal to services.
  • -I: Interrupt, which sends an INT signal to services.
  • -T: Terminate, which sends a TERM signal to services.
  • -K: Kill: Send a KILL signal to services.
  • -X: Exit, supervise will exit immediately after services are stopped, but it is worth noting that if you use this option in a stable system, you have started to make mistakes: supervise is designed to run forever.
Svok:Used to check whether supervise is running. Checks whether SuperviseIs successfully running in the directory named Service. It silently exits 0 if SuperviseIs successfully running. It silently exits 100 if SuperviseIs not successfully running. I am a Tom. I cannot translate it for the time being. please follow up with me to translate it. Svstat: usage: [Plain]View plaincopyprint?
  1. Svstat services
Print the running status of services monitored by supverise.
2. install daemontools on centOS6.4 first install the nano editor, which is much more convenient than the vi editor. enter: Yum install nano
  • Mkdir-p/package// Create a folder
  • Chmod 1755/package// Change the folder ACL
  • Cd/package// Enter this folder
  • Wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz// Use the wget command to download daemontools to the current directory
  • Gunzip daemontools-0.76.tar
  • Tar-xpf daemontools-0.76.tar //Decompress daemontools in these two steps
  • Rm-f daemontools-0.76.tar// Delete the installation package
  • Daemontools-0.76/cd admin/// Enter the installation folder
  • Nano src/conf-cc// Edit the src/conf-cc file to prevent errors during subsequent installation,NanoIs a text editor
  • In the edit window that appears, add an empty grid at the end of the line starting with gcc-Include/usr/include/errno. hAfter the process is completed, Ctrl + X is saved and exited. if the nano editor is not used, it can be replaced by another editor.
  • Package/install// Install
  • Cat/etc/inittab// View the inittab. you can see this line: SV: 123456: respawn:/command/svscanboot was appended.
  • Note: The Boot start method described in the original article has expired in centos6.4. if daemontools is not started after the restart, it indicates that it is invalid. useSvstat Service DirectoryTo check whether the service is started.We use the new method:
  • Delete the row added in the/etc/iinittab: SV: 123456: respawn... because it is useless.
  • Cd/etc/init
  • Nano svscan. confCreate a new file named svscan. conf
  • Add
start on runlevel [345]    respawn    exec /command/svscanboot
 
  • Then let init reload the configuration and start svscanboot.
  • Initctl reload-configuration
  • Initctl start svscan

Related Article

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.