简体   繁体   English

重新启动后,debian init.d脚本未运行

[英]debian init.d script not running after reboot

I need to start my Wildfly AS through .sh script after system boot (Linux-Debian). 系统启动(Linux-Debian)后,我需要通过.sh脚本启动我的Wildfly AS。 So I created my own script which should do it in init.d: 因此,我创建了自己的脚本,应在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

This works if i use it on my own: /etc/init.d/starter start . 如果我自己使用它,这将起作用/etc/init.d/starter start

Then I used command to create symlinks: update-rc.d starter defaults . 然后,我使用命令创建符号链接: update-rc.d starter defaults Symlinks are created just as expected, however after reboot command the script is not executed. 符号链接的创建与预期的一样,但是在reboot命令后,脚本未执行。

Does someone knows what prevents my script from being executed after boot? 有人知道启动后阻止我的脚本执行的原因吗? Thank you for all your advices. 感谢您的所有建议。

Problem was that i did not know that initial script must set its own $PATH and other variables . 问题是我不知道初始脚本必须设置自己的$ PATH和其他变量 I found it out when I saw java:not found in /var/log/daemon. 我在/ var / log / daemon中看到java:not时发现了它。 At the end I found that wildfly has its own scirpt init-debian.sh . 最后,我发现wildfly有自己的脚本init-debian.sh I used it and it works. 我用它,它的工作原理。

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

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