重新启动后,debian init.d脚本未运行 [英] debian init.d script not running after reboot

查看:522
本文介绍了重新启动后,debian init.d脚本未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在系统启动(Linux-Debian)之后,我需要通过.sh脚本启动Wildfly AS。因此,我创建了自己的脚本,应该在init.d中执行该操作:

I need to start my Wildfly AS through .sh script after system boot (Linux-Debian). So I created my own script which should do it in init.d:

#! /bin/sh
# /etc/init.d/starter

case "$1" in
  start)
    echo "Starting"
    nohup /home/xxx/wildfly-9.0.1.Final/bin/standalone.sh &
    ;;
  stop)
    echo "Stopping"
    /home/xxx/wildfly-9.0.1.Final/bin/jboss-cli.sh --connect command=:shutdown
    ;;
  *)
    echo "Usage: /etc/init.d/starter {start|stop}"
    exit 1
    ;;
esac
exit 0

如果有效,我自己使用它: /etc/init.d/starter start

This works if i use it on my own: /etc/init.d/starter start.

然后我使用命令来创建符号链接: update-rc.d入门默认值。符号链接的创建与预期的一样,但是在重新启动命令之后,脚本没有执行。

Then I used command to create symlinks: update-rc.d starter defaults. Symlinks are created just as expected, however after reboot command the script is not executed.

有人知道是什么阻止了我的脚本从启动后被执行?谢谢您的所有建议。

Does someone knows what prevents my script from being executed after boot? Thank you for all your advices.

推荐答案

问题是我不知道初始脚本必须设置自己的$ PATH和其他变量。我在/ var / log / daemon中看到java:not时发现了它。最后,我发现wildfly有自己的脚本 init-debian.sh 。我用了它,而且效果很好。

Problem was that i did not know that initial script must set its own $PATH and other variables. I found it out when I saw java:not found in /var/log/daemon. At the end I found that wildfly has its own scirpt init-debian.sh. I used it and it works.

这篇关于重新启动后,debian init.d脚本未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆