S
S
Sveratum2014-02-13 07:25:50
Node.js
Sveratum, 2014-02-13 07:25:50

init.d run forever script for node.js apps under centos 6.4?

In general, everything is said in the topic.
This script is not suitable, the application starts, but when you try to stop or restart, it says that it is not running, although the output of the forever list command shows it, and it works.
Everything I find is made under ubuntu, but I need it under centos.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fart, 2014-02-13
@srsd

Greetings. Here on a knee the script has been thrown. It seems to work on CentOS 6.4.
There is a bug: there is no check that forever is running. It doesn’t bother us because we launched it and don’t touch it)

#!/bin/sh
# chkconfig: 2345 90 60
#/etc/init.d/nodeup


export PATH=$PATH:/usr/local/bin
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules

case "$1" in
  start)
  cd /home/administrator/ASP/scripts
  exec forever start --sourceDir=/home/administrator/ASP/scripts -p /home/admini                                                                                               strator/ASP/scripts/log  index.js
  ;;
stop)
  exec forever stop --sourceDir=/home/administrator/ASP/scripts index.js
  ;;
*)
  echo "Usage: /etc/init.d/nodeup {start|stop}"
  exit 1
  ;;
esac

exit 0

S
Sveratum, 2014-02-13
@srsd

In general, it works, I put it in autostart.
I'll try experimenting with the fit for myself.
Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question