systemctl重新加载_如何使用systemctl重新启动服务

我创建了一个系统服务,可以通过运行命令服务来启动/停止/重启 . 但是当我尝试通过systemctl执行此操作时,我总是遇到错误 . 我不知道我的脚本文件有什么问题 . 为什么它可以通过服务而不是systemctl来管理?

# systemctl restart cooltoo_storage

Job for cooltoo_storage.service failed because the control process exited with error code. See "systemctl status cooltoo_storage.service" and "journalctl -xe" for details.

以下是“systemctl status cooltoo_storage.service”的输出

# systemctl status cooltoo_storage.service

●cooltoo_storage.service - LSB:cooltoo存储提供程序已加载:已加载(/etc/rc.d/init.d/cooltoo_storage)活动:失败(结果:退出代码)自Tue 2016-05-03 17:17:12 CST ; 1分29秒前Docs:man:systemd-sysv-generator(8)进程:32268 ExecStart = / etc / rc.d / init.d / cooltoo_storage start(code = exited,status = 203 / EXEC)

May 03 17:17:12 Cool-Too systemd[1]: Starting LSB: cooltoo storage provider...

May 03 17:17:12 Cool-Too systemd[1]: cooltoo_storage.service: control process exited, code=exited status=203

May 03 17:17:12 Cool-Too systemd[1]: Failed to start LSB: cooltoo storage provider.

May 03 17:17:12 Cool-Too systemd[1]: Unit cooltoo_storage.service entered failed state.

May 03 17:17:12 Cool-Too systemd[1]: cooltoo_storage.service failed.

下面是我的脚本文件/etc/init.d/cooltoo_storage,

### BEGIN INIT INFO

# Provides: cooltoo storage provider

# Required-Start: $local_fs $remote_fs $network $time $named

# Should-Start: $time sendmail

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: cooltoo storage provider

# Description: cooltoo storage provider

# chkconfig: 2345 90 90

### END INIT INFO

start() {

nginx -c /data/nginx/nginx.config

}

stop() {

nginx -c /data/nginx/nginx.config -s stop

}

restart() {

nginx -c /data/nginx/nginx.config -s reload

}

status() {

echo ''

}

action="$@"

if [[ "$MODE" == "auto" && -n "$init_script" ]] || [[ "$MODE" == "service" ]]; then

action="$1"

shift

fi

case "$action" in

start)

start ; exit $?;;

stop)

stop ; exit $?;;

restart)

restart ; exit $?;;

status)

status ; exit $?;;

*)

echo "Usage: $0 {start|stop|restart|force-reload|status|run}"; exit 1;

esac

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值