【问题标题】:rc.local not running second script if first is '/opt/lampp/lampp start'如果第一个是'/opt/lampp/lampp start',rc.local 不运行第二个脚本
【发布时间】:2017-02-22 09:21:04
【问题描述】:

我有脚本在启动时停止网络管理器。我在 rc.local 中为此做了条目。它工作正常。但是在一台服务器上安装了 MySQL,并且 rc.local 已经有一个用于 start lampp 的条目。 (/opt/lampp/lampp 启动)。

在那之后我为我的脚本做了条目。现在 rc.local 是这样的:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/opt/lampp/lampp start
sh /etc/startupscript.sh
exit 0

在启动时第一个条目执行并且日志在 boot.log 是:


跳过 /etc/apparmor.d/disable 中的配置文件:usr.sbin.rsyslogd * 启动 AppArmor 配置文件 [确定] 启动 XAMPP for Linux 5.6.24-1... XAMPP:启动 Apache ......好的。 XAMPP:启动 MySQL ......好的。 XAMPP:启动 ProFTPD ......好的。 启动 XAMPP for Linux 5.6.24-1... XAMPP:启动 Apache...失败。 XAMPP:另一个 Web 服务器已经在运行。 XAMPP:正在启动 MySQL...好的。

XAMPP:正在启动 ProFTPD...已经在运行。

然后退出。第二行 sh /etc/startupscript.sh 未执行。

如果我手动执行 rc.local,两个脚本都会成功运行。 提前致谢。

【问题讨论】:

  • 你的意思是如果“/opt/lampp/lampp start”行不存在那么startupscript.sh被执行?
  • 正确的Prabhu,由于上一个错误而退出。

标签: linux lampp


【解决方案1】:

我得到了答案.. 在 rc.local 的第一行,有 -e 表示“出错时退出”我将其删除,然后所有脚本都成功运行。并且不会相互影响。

【讨论】:

    猜你喜欢
    • 2016-11-10
    • 2022-10-02
    • 2021-01-15
    • 2015-06-26
    • 2017-04-11
    • 1970-01-01
    • 2023-02-08
    • 2013-06-05
    • 2021-07-01
    相关资源
    最近更新 更多