Hi,
I have root access on a Debian 7 server.
I have a deamon sitting in /etc/init.d/learnintouchsocket which I installed with the command: insserv learnintouchsocket
Here it is:
Code:
#!/bin/sh
#
# Learnintouch Socket server: Start/stop the Learnintouch Socket server
#
### BEGIN INIT INFO
# Provides: learnintouchsocket
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start learnintouchsocket at boot time
# Description: Enable learnintouchsocket provided by daemon.
### END INIT INFO
case "$1" in
start)
/home/stephane/learnintouch/engine/js/socket/start.sh
echo "Starting the socket server:"
;;
stop)
;;
*)
echo "Usage: %s {start|stop}\n" "$0"
exit 1
;;
esac
exit 0
Here is the content of the /home/stephane/learnintouch/engine/js/socket/start.sh file:
Code:
#!/bin/sh
echo 'In the start.sh file' >> /home/stephane/learnintouch/engine/js/socket/nodejs.log
nohup /home/stephane/programs/install/bin/node /home/stephane/learnintouch/engine/js/socket/elearning-server.js 2>&1 >> /home/stephane/learnintouch/engine/js/socket/nodejs.log &
After a server reboot I can see in the /home/stephane/learnintouch/engine/js/socket/nodejs.log file the following:
But the log shows the following:
Quote:
In the start.sh file
module.js:340
throw err;
^
Error: Cannot find module 'utils.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/stephane/learnintouch/engine/js/socket/elearning-server.js:1:75)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
|
This tells me the custom node_module was not found.
Well, if I run manually, that is, by logging as root, and typing in the command: /etc/init.d/learnintouchsocket start
then the log shows:
Quote:
In the start.sh file
info: socket.io started
The NodeJS http server is listening...
|
To sum it up, the custom node_module is found when I run the init script manually as root, and it is not found when it is run as a deamon at reboot time.
Any clue ?
Kind Regards,
Stephane