Boot script in/etc/init.d directory
1.
More redis_8010
#/bin/sh
#Configurations injected by Install_server below ....
Exec=/usr/local/bin/redis-server
Cliexec=/usr/local/bin/redis-cli
Pidfile=/var/run/redis_8010.pid
conf= "/etc/redis/8010.conf"
Redisport= "8010"
###############
Case "$" in
Start
If [-F $PIDFILE]
Then
echo "$PIDFILE exists, process is already running or crashed"
Else
echo "Starting Redis server ..."
$EXEC $CONF
Fi
;;
Stop
if [!-F $PIDFILE]
Then
echo "$PIDFILE does not exist, process was not running"
Else
pid=$ (Cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC-P $REDISPORT shutdown
While [-x/proc/${pid}]
Do
echo "Waiting for Redis to shutdown ..."
Sleep 1
Done
echo "Redis stopped"
Fi
;;
*)
echo "Please use Start or stop as first argument"
;;
Esac
2.
Under the/ect/rc0--6.d/directory
lrwxrwxrwx 1 root root 1 14:30 k20redis_8010. /init.d/redis_8010
is a soft connection to the files in the INIT.D directory
Service is stopped at shutdown level
such as K20rsync. /init.d/rsync
More/etc/init.d/rsync
#! /bin/sh
# # # BEGIN INIT INFO
# PROVIDES:RSYNCD
# Required-start: $remote _fs $syslog
# required-stop: $remote _fs $syslog
# Should-start: $named
# Default-start:2 3 4 5
# Default-stop:
# short-description:fast Remote file copy program daemon
# Description:rsync is a program this allows files to being copied to and
# from remote machines in much the same as RCP.
# This provides RSYNCD daemon functionality.
# # # END INIT INFO
Set-e
#/etc/init.d/rsync:start and stop the rsync daemon
Daemon=/usr/bin/rsync
Rsync_enable=false
Rsync_opts= "
Rsync_defaults_file=/etc/default/rsync
Rsync_config_file=/etc/rsyncd.conf
Rsync_pid_file=/var/run/rsync.pid
Rsync_nice_parm= "
Rsync_ionice_parm= "
Test-x $DAEMON | | Exit 0
. /lib/lsb/init-functions
If [-S $RSYNC _defaults_file]; Then
. $RSYNC _defaults_file
Case ' x$rsync_enable ' in
Xtrue|xfalse);;
XINETD) Exit 0
;;
*) log_failure_msg "Value of rsync_enable in $RSYNC _defaults_file must be either
' True ' or ' false '; "
Log_failure_msg "not starting rsync daemon."
Exit 1
;;
Esac
Case ' X$rsync_nice ' in
X[0-9]) rsync_nice_parm= "--nicelevel $RSYNC _nice";;
X1[0-9]) rsync_nice_parm= "--nicelevel $RSYNC _nice";;
x);;
*) log_warning_msg "value of Rsync_nice in $RSYNC _defaults_file must is a value B
Etween 0 and (inclusive); "
Log_warning_msg "Ignoring rsync_nice now."
;;
Esac
Case ' X$rsync_ionice ' in
x-c[123]*) rsync_ionice_parm= "$RSYNC _ionice";;
x);;
*) log_warning_msg "Value of Rsync_ionice in $RSYNC _defaults_file must be-c1,-C
2 or-c3; "
Log_warning_msg "Ignoring rsync_ionice now."
;;
Esac
Fi
Export path= "${path:+ $PATH:}/usr/sbin:/sbin"
Rsync_start () {
If [!-S ' $RSYNC _config_file "]; then
log_failure_msg" missing or empty CONFIG FILE $RSYNC _con Fig_file "
Log_end_msg 1
Exit 0
Fi
# See Ionice (1)
If [-N" $RSYNC _ionice_parm "] && [-x/usr/ Bin/ionice] &&
/usr/bin/ionice "$RSYNC _ionice_parm" true 2>/dev/null; then
/usr/bin/ionice "$RSYNC _ Ionice_parm "-p$$ >/dev/null 2>&1
Fi
If Start-stop-daemon--start--quiet--background \
--pidfile $RSYNC _pid_file--make-pidfile \
$RSYNC _nice_parm--exec $DAEMON \
----No-detach--daemon--config "$RSYNC _confi G_file "$RSYNC _opts
then
rc=0
Sleep 1
if! kill-0 $ (cat $RSYNC _pid_file) >/dev/null 2>&1; then< br> log_failure_msg "Rsync daemon failed to start"
Rc=1
Fi
Else
rc=1
fi
If [$rc-eq 0]; then
Log_end_msg 0
Else
log_end_msg 1
rm-f $RSYNC _pid_file
Fi
} # Rsync_start
Case "$" in
Start
If "$RSYNC _enable"; Then
Log_daemon_msg "Starting rsync daemon" "Rsync"
If [-S $RSYNC _pid_file] && kill-0 $ (cat $RSYNC _pid_file) >/dev/null 2>&1; Then
Log_progress_msg "apparently already running"
Log_end_msg 0
Exit 0
Fi
Rsync_start
Else
If [-S "$RSYNC _config_file"]; Then
["$VERBOSE"! = no] && log_warning_msg "rsync daemon not enabled in $RSYNC _defaults_f
ILE, not starting ... "
Fi
Fi
;;
Stop
Log_daemon_msg "Stopping rsync daemon" "Rsync"
Start-stop-daemon--stop--quiet--oknodo--pidfile $RSYNC _pid_file
Log_end_msg $?
Rm-f $RSYNC _pid_file
;;
Reload|force-reload)
Log_warning_msg "Reloading rsync daemon:not needed, as the daemon"
Log_warning_msg "re-reads the config file whenever a client connects."
;;
Restart
Set +e
If $RSYNC _enable; Then
Log_daemon_msg "Restarting Rsync daemon" "Rsync"
If [-S $RSYNC _pid_file] && kill-0 $ (cat $RSYNC _pid_file) >/dev/null 2>&1; Then
Start-stop-daemon--stop--quiet--oknodo--pidfile $RSYNC _pid_file | | True
Sleep 1
Else
Log_warning_msg "Rsync Daemon not running, attempting to start."
Rm-f $RSYNC _pid_file
Fi
Rsync_start
Else
If [-S "$RSYNC _config_file"]; Then
["$VERBOSE"! = no] && log_warning_msg "rsync daemon not enabled in $RSYNC _defaults_f
ILE, not starting ... "
Fi
Fi
;;
Status
Status_of_proc-p $RSYNC _pid_file "$DAEMON" RSYNC
Exit $? # notreached due to SET-E
;;
*)
echo "Usage:/etc/init.d/rsync {start|stop|reload|force-reload|restart|status}"
Exit 1
Esac
Exit 0
[Email protected]:/etc/rc0.d$
Ubuntu Start Stop Script