debian init.d script not running after reboot

折月煮酒 提交于 2019-12-12 03:32:29

问题


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

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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/36391709/debian-init-d-script-not-running-after-reboot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!