Server IP : 85.214.239.14 / Your IP : 18.119.159.109 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/root/proc/2/cwd/proc/3/root/etc/init.d/ |
Upload File : |
#! /bin/bash ### BEGIN INIT INFO # Provides: memcached # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: memcached - Memory caching daemon # Description: memcached - Memory caching daemon ### END INIT INFO # Usage: # cp /etc/memcached.conf /etc/memcached_server1.conf # cp /etc/memcached.conf /etc/memcached_server2.conf # start all instances: # /etc/init.d/memcached start # start one instance: # /etc/init.d/memcached start server1 # stop all instances: # /etc/init.d/memcached stop # stop one instance: # /etc/init.d/memcached stop server1 # There is no "status" command. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/memcached DAEMONNAME=memcached DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached DESC=memcached test -x $DAEMON || exit 0 test -x $DAEMONBOOTSTRAP || exit 0 set -e if [ -f /etc/default/memcached ] ; then . /etc/default/memcached fi . /lib/lsb/init-functions FILES=(/etc/memcached_*.conf) # check for alternative config schema if [ -r "${FILES[0]}" ]; then CONFIGS=() for FILE in "${FILES[@]}"; do # remove prefix NAME=${FILE#/etc/} # remove suffix NAME=${NAME%.conf} # check optional second param if [ $# -ne 2 ]; then # add to config array CONFIGS+=($NAME) elif [ "memcached_$2" == "$NAME" ]; then # use only one memcached CONFIGS=($NAME) break; fi; done; if [ ${#CONFIGS[@]} == 0 ]; then echo "Config not exist for: $2" >&2 exit 1 fi; else CONFIGS=(memcached) fi; CONFIG_NUM=${#CONFIGS[@]} for ((i=0; i < $CONFIG_NUM; i++)); do NAME=${CONFIGS[${i}]} PIDFILE="/var/run/${NAME}.pid" case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile $PIDFILE --exec $DAEMON echo "$NAME." rm -f $PIDFILE ;; status) [ $# -lt 2 ] && NAME=$DAEMONNAME PIDFILE="/var/run/$NAME.pid" set +e start-stop-daemon --status --pidfile $PIDFILE case $? in 0) echo "$DESC: $NAME (pid $(cat $PIDFILE)) is running" && exit 0;; 1) echo "$DESC: $NAME is not running thro' the pid file exists" && rm -f $PIDFILE && exit 1;; 3) echo "$DESC: $NAME is not running" && exit 3;; 4) echo "$DESC: $NAME status is unclear, sorry" && exit 4;; esac ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile $PIDFILE rm -f $PIDFILE sleep 1 start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE echo "$NAME." ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 exit 1 ;; esac done; exit 0