reboot 关机时提示job is running for etcrc.drc.load Compatibility

xiaoxiao2021-02-28  48

/etc/rc.d/rc.load( 这个是/etc/rc.load软链过去的)中的内容引起的重启时关机失败。(也不是每次重启都失败,但是也会频繁发生)在rc.local里开机自动启动程序,但是关机重启时受到了影响。

/etc/rc.d/rc.load 文件中的命令不要放大于5s的命令,如果有,就用shell脚本,写到外边去。或者将/etc/rc.d/rc.load开机启动的时间设置长一些。

如果注释掉/etc/rc.d/rc.load的内容重启成功。

也可以看看/var/log/messages

 

通过这个http://bbs.qcloud.com/thread-11819-1-1.html 解决了这个问题

 

#!/bin/bash #only centos need fix if [ ! -f /etc/centos-release ]; then     echo "this is not centos linux"     exit 1 fi #only centos7.0 7.1 7.2 need fix osversion=`awk '{print $4}' /etc/centos-release` if [ ${osversion} != '7.0.1406' ] &&     [ ${osversion} != '7.1.1503' ] &&     [ ${osversion} != '7.2.1511' ]; then     echo "this is not centos7.0 7.1 7.2"     exit 1 fi #create rc-local.service cat > /etc/systemd/system/rc-local.service <<EOF #  This file is part of systemd. # #  systemd is free software; you can redistribute it and/or modify it #  under the terms of the GNU Lesser General Public License as published by #  the Free Software Foundation; either version 2.1 of the License, or #  (at your option) any later version. # This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.d/rc.local is executable. [Unit] Description=/etc/rc.d/rc.local Compatibility ConditionFileIsExecutable=/etc/rc.d/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.d/rc.local start TimeoutSec=5 RemainAfterExit=yes EOF #modify the default timeout of systemd sed -i 's/#DefaultTimeoutStopSec=90s/DefaultTimeoutStopSec=30s/g' /etc/systemd/system.conf systemctl daemon-reload exit 0

 

 

 

这些还是放supervisor比较好,或者写一个service。简单的很 [Unit] Description=服务名称 After=network.target [Service] Type=forking ExecStart=完整的执行程序,例如:/usr/bin/licensing ExecReload=软件停止命令,例如:/usr/bin/licensing -s stop PrivateTmp=true [Install] WantedBy=multi-user.target

 

 

然后放在/usr/lib/systemd/system/下面

 

# 启动服务 systemctl daemon-reload systemctl enable licensing.service systemctl start licensing.service

 

systemctl -t service 查看所有服务的状态

 

 

转载请注明原文地址: https://www.6miu.com/read-38912.html

最新回复(0)