开机自动启动应用程序

开机自动启动应用程序

我有两个应用程序遇到了问题:memcached 和 supervisord

目前,每次我重新启动服务器时,我都需要记住运行

memcached -d -u regularUser
supervisorctl start laravel-worker:*
supervisorctl start laravel-backup:*
supervisorctl start laravel-restore:*
supervisorctl start laravel-default:* 

如果由于某种原因服务器在夜间重新启动,这是不切实际的。

我已经运行“chkconfig memcached on”和“chkconfig supervisord on”。

/etc/init.d/memcached 看起来像这样(片段):

#!/bin/sh
#
# memcached    Startup script for memcached processes
#
# chkconfig: - 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached

[ -f memcached ] || exit 0

prog="memcached"

start() {
    echo -n $"Starting $prog "

    memcached -d -u regularUser

    RETVAL=$?
    echo
    return $RETVAL
}

/etc/init.d/supervisord 如下所示:

#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
# description: Supervisor Server
# processname: supervisord

# Source init functions
. /etc/rc.d/init.d/functions

prog="supervisord"

prefix="/usr/"
exec_prefix="${prefix}"
prog_bin="${exec_prefix}/bin/supervisord"
PIDFILE="/var/run/$prog.pid"

start()
{
       echo -n $"Starting $prog: "
       daemon $prog_bin --pidfile $PIDFILE
       [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"

supervisorctl start laravel-worker:*
supervisorctl start laravel-backup:*
supervisorctl start laravel-restore:*
supervisorctl start laravel-default:*
       echo
}

我做错了什么;我的问题该如何解决?

答案1

只需在两个脚本的以下几行中将连字符 (-) 替换为 2345

# chkconfig: - 64 36
# chkconfig: - 90 10

相关内容