First, copy the following template for backup. The following is an explanation! Binsh indicates the shell type called by the script. chkconfig: 23458005 indicates the operation of the service.
Copy the following template for backup.
#! /Bin/sh indicates the shell type called by the script.
# Chkconfig: 2345 80 05 2345 indicates the service running level. 80 indicates that the 80th service must be started when the system starts (the service number can be repeated ). 05 indicates the service number to be stopped when the system is disabled.
# Descr restart ption: you can add the service here, but you must have
Case $1 in here is a selection statement. $1 is a variable used to refer to the following start, stop, and so on.
Then you can write the command to start the service.
Stop) is the command executed when the service is stopped.
.
Save it as a service file, copy it to/etc/init. d/, start shell, and enter
Chkconfig -- add service
The service is successfully added.
Then you can use chkconfig -- list to view the custom service in the service list.
#! /Bin/sh # chkconfig: 2345 80 05 # descr restart ption: service case $1 instart); stop );;*);;
Esac