#!/bin/bash
# # # BEGIN INIT INFO
# Provides:xiyoulib
# Required-start: $all
# Required-stop: $all
# Default-start:2 3 4 5
# default-stop:0 1 6
# Short-description:start daemon at boot time
# Description:enable service provided by Daemon.
# # # END INIT INFO
# chkconfig:345 88 08
# Description:forever for node. js
Deamon=/usr/local/src/node/pwp/server/mongo/getdata.js
Log=/usr/local/src/node/pwp/server/logs/forever.log
Pid=/usr/local/src/node/pid
Export path= $PATH:/usr/local/bin
Export Node_path= $NODE _path:/usr/local/lib/node_modules
Node=node
Forever=forever
Case "$" in
Start
$forever start-l $LOG--pidfile $PID-a $DEAMON
;;
Stop
$forever Stop--pidfile $PID $DEAMON
;;
StopAll)
$forever StopAll--pidfile $PID
;;
Restartall)
$forever Restartall--pidfile $PID
;;
Reload|restart)
$forever restart-l $LOG--pidfile $PID-a $DEAMON
;;
List
$forever List
;;
*)
echo "Usage:/etc.init.d/node {start|stop|restart|reload|stopall|restartall|list}"
Exit 1
;;
Esac
The above code is node's start-up and error after the start of their own problems
is configured in the/etc/init.d/node file
Because forever is not self-priming under rc.local.
Configure MONGO
echo "/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data/db--logpath=/usr/local/mongodb/logs/ Mongodb.log--fork ">>/etc/rc.local