简体   繁体   English

脚本不会在Red Hat重启或关闭时启动

[英]Script wont launch on reboot or shutdown on Red Hat

I have a script called "storelogs" located in /etc/init.d and I have link to this in /etc/rc0.d and /etc/rc6.d called "K01storelogs". 我在/etc/init.d中有一个名为“ storelogs”的脚本,并且在/etc/rc0.d和/etc/rc6.d中有名为“ K01storelogs”的链接。

The script runs absolutely fine when I call it directly from /etc/init.d but when I try and reboot the machine, the script doesn't ever seem to get called. 当我直接从/etc/init.d调用脚本时,脚本运行得很好,但是当我尝试重新启动计算机时,似乎从未调用过该脚本。

The script actually calls a php script which does a few bits and peices - and like I said, the script runs fine when I call it directly. 该脚本实际上调用了一个php脚本,该脚本执行了一些操作和操作-就像我说的那样,当我直接调用该脚本时,该脚本运行良好。

The script is incredibly simple: 该脚本非常简单:

#!/bin/sh
/usr/bin/php /var/www/html/storeLogs.php

Have I missed a step? 我错过了一步吗? Whats an easy way to debug this? 有什么简单的方法可以调试?

Cheers in advance! 提前加油!

Andy 安迪

Are you sure the script is actually runing at startup ? 您确定脚本实际上在启动时正在运行吗? You can try to add something like logger "my script is ruuning" in the script in order to be sure. 您可以尝试在脚本中添加类似记录器“ my script is ruuning”的记录,以便确定。

Please check also with chkconfig tool if the startup links are ok for your runlevel 请也使用chkconfig工具检查启动链接是否适合您的运行级别

  • runlevel 运行级别
  • "chkconfig --list" “ chkconfig --list”

您的链接名为K01storelogs还是S01storelogs?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM