1

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.

Jan Tomášek
  • 135
  • 10
  • Which version of Debian? Debian v6 or later replaced *update-rc.d* with *inserve*... see Debian Wiki [How to add a service when using dependency-based booting] (https://wiki.debian.org/LSBInitScripts/DependencyBasedBoot) – agc Apr 04 '16 at 04:43
  • @agc Thank you for your reply. Im runing 8.3. In man insserv i read: "It is not recommended to execute insserv directly unless you know exactly what you're doing, doing so may render your boot system inoperable. update-rc.d is the recommended interface for managing init scripts." So that is not the problem. – Jan Tomášek Apr 04 '16 at 07:28
  • Sorry -- I missed that. Hmm, permissions, maybe. Is there anything unusual in the output of this: **find /etc/rc?.d/ -name '*starter' -exec ls -l '{}' \; ; ls -l /etc/init.d/starter** Typically every link should be owned by *root* and be file mode 'lrwxrwxrwx (0777)', the file itself has mode '-rwxrwxr-x (0775)'. – agc Apr 05 '16 at 03:53

1 Answers1

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.

Jan Tomášek
  • 135
  • 10