In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use System V init startup scripts in CentOS. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The CentOS system itself comes with instructions, in / usr/share/doc/initscripts- (*) / sysvinitfiles, as follows: all System V init scripts are named / etc/rc.d/init.d/, where is the name of the service. Must not have the suffix ".init".
Sample script:
#! / bin/bash## / etc/rc.d/init.d/## Source function library.. / etc/rc.d/init.d/functionscase "$1" in start) echo-n "Starting services:" touch / var/lock/subsys/;; stop) echo-n "Shutting down services:" rm-f / var/lock/subsys/;; status); restart);; reload) Probe); *) echo "Usage: {start | stop | status | reload | restart [| probe]" exit 1;; esac
Note: restart and reload functions can be (usually) combined into one test
Vis:restart | reload)
You are not prohibited from adding other commands; list all commands that you intend to use interactively to use messages.
/ etc/rc.d/init.d/functions function daemon [+ /-nicelevel] program [arguments] [&]
If the daemon is not already running, start it. There are other useful things, such as keeping the daemon if the daemon terminates unexpectedly.
Killproc program [signal]
Send a signal to the program; by default, it sends a SIGTERM, and if the process is not dead, it sends a SIGKILL in a few seconds.
If the pid file is found, it will also try to delete it.
Pidofproc program
Try to find a program's pid; to check for possible pidfiles, use the pidof program, or even use ps. It is mainly used for other functions in this file, but it can also be used for scripts.
Status program
Print status information. Assume that the program name is the same as servicename.
Tags.# chkconfig:
Must. Is a list of levels at which services should be started by default. And are priority numbers. For example:
# chkconfig:2345 20 80 read "man chkconfig" for more information.
Unless there is a very good, dominant opposite reason, it should be equal to 100-
# description:
Must. A few lines of description, continue to use the'\ 'character. The initial comments and subsequent spaces in the following line will be ignored.
# description [ln]:
Optional. The description should be translated into the specified language.
# processname:
Optional, multiple entries are allowed. For each process name started by the script, there should be a process name entry. For example, the samba service starts two daemons:
# processname:smdb # processname:nmdb# config:
Optional, multiple entries are allowed. For each static configuration file used by the daemon, use a single entry. For example:
# config: / etc/httpd/conf/httpd.conf # config: / etc/httpd/conf/srm.conf
(optional) if the server will automatically reload the configuration file (if it has changed), you can append the word "autoreload" to the line:
# config: / etc/foobar.conf autoreload
# pidfile:
Optional, multiple entries are allowed. Use it just like a configuration entry, except that it points to pidfiles. Assume that pidfiles is updated only when the process is created, not later. The first line of the file should be the ASCII representation of PID; terminating the newline character is optional. No lines other than the first line are checked.
# project: true
Optionally, use IN PLACE's processname,config and pidfile. If it exists, you can achieve the correct reload by running the following command-if necessary:
Command = $(/ etc/ rd.d / init.d/SCRIPT probe) [- n "$command"] & & / etc/rc.d/init.d/SCRIPT $command
Where SCRIPT is the name of the sysv init script for the service.
As an example, a script that needs to perform complex processing can return "run / var/tmp/"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.