I have a simple init.d script that runs a bash script:
### BEGIN INIT INFO
# Provides: registertool
# Required-Start: $network $local_fs $syslog $remote_fs networking
# Required-Stop: $network $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts registration script
# Description: Starts the registration script
### END INIT INFO
./register.sh -v &
echo $! > "$PID_FILE"
log_action_msg "Registration started with pid $!"
case $1 in
echo $USAGE >&2
Inside the script, I define my node as
NODE=$(which node) and run an application as
$NODE myApp.js. I have defined the path in the script as
However, my node is not even called! What am I doing wrong? What else do I need to wait for to boot up?
NODE=$(which node) will search
$PATH to find the executable. If your path has not been defined, it won't find anything. Try having your script log each step so you can see where it goes sideways.
./register.sh will depend on the current directory being something specific. During system startup,
cwd may not even be defined.