CentOS6.4 install daemontools

Source: Internet
Author: User

CentOS6.4 install 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 (see supervise) process in all sub-directories under 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. Svcoptsservices
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 no longer start.
  • -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, which sends a CONT signal to services.
  • -H: hang up, which sends an HUP signal to services.
  • -A: 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 exits immediately after services are stopped. However, if you use this option in a stable system, you have already made 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. Svstatservices
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 // grant the folder permission
  • Cd/package // enter this folder
  • Wgethttp: // 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 // extract daemontools in both steps
  • Rm-f daemontools-0.76.tar // Delete the installation package
  • Cd admin/daemontools-0.76 // enter the installation folder
  • Nano src/conf-cc // edit the src/conf-cc file to prevent errors during subsequent installation. nano is a text editor.
  • Add-include/usr/include/errno at the end of the line starting with gcc in the open edit window. h. After that, press Ctrl + X to save and exit. If the nano editor is not used, it can be replaced by another editor.
  • Package/install // install
  • Cat/etc/inittab // view inittab. You can see this line: SV: 123456: respawn:/command/svscanboot was appended.
  • Note: The method introduced in the original article has expired in centos6.4. If daemontools is not started after the restart, it indicates that it is invalid. Use the svstat service directory to 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. conf creates 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

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.