Environment centos7
problem description: there is no problem with direct command startup.
Service startup script / etc/init.d/memcached
added to the service chkconfig-- add memcached
/ etc/init.d/memcached
-sharp! /bin/sh
-sharp
-sharp chkconfig: - 55 45
-sharp description: The memcached daemon is a network memory cache service.
-sharp processname: memcached
-sharp config: /etc/sysconfig/memcached
-sharp Source function library.
. /etc/rc.d/init.d/functions
PORT=11050
USER=nobody
MAXCONN=1024
CACHESIZE=2048
OPTIONS=""
if [ -f /etc/sysconfig/memcached ];then
. /etc/sysconfig/memcached
fi
-sharp Check that networking is up.
if [ "$NETWORKING" = "no" ]
then
exit 0
fi
RETVAL=0
prog="memcached"
start () {
echo -n $"Starting $prog: "
-sharp insure that /var/run/memcached has proper permissions
chown $USER /var/run/memcached
daemon /usr/local/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached
}
stop () {
echo -n $"Stopping $prog: "
killproc memcached
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/memcached
rm -f /var/run/memcached/memcached.pid
fi
}
restart () {
stop
start
}
-sharp See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status memcached
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/memcached ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $?
the platform version of the problem and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)