Skip to content
Răzvan Crainea edited this page Sep 2, 2016 · 8 revisions

HEPIPE Autostart Debian

To start HEPIPE automatically on your Debian Server you need a init.d script for starting the HEPIPE as a service.

Requirements:

  • hepipe.js

====== 1.) Install forever sudo npm install -g forever

2.) Make a directory for logfiles

sudo mkdir /var/log/forever
sudo mkdir /var/log/hepipe

3.) Create Service file

sudo touch /etc/init.d/hepipe
sudo chmod a+x /etc/init.d/hepipe
sudo update-rc.d hepipe defaults

4.) Edit service file nano /etc/init.d/hepipe

5.) Copy this content to the file:

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

case "$1" in
   start)
   exec forever --sourceDir=/usr/src/hepipe.js -p /var/log/forever start -o /var/log/hepipe/hepipe.log -e /var/log/hepipe/error.log -a --minUptime 1000 --spinSleepTime 3000 hepipe.js
   ;;
   stop)
   exec forever stop --sourceDir=/usr/src/hepipe.js hepipe.js
   ;;
   status)
   forever list |grep -q hepipe || exit 1
   ;;
 esac

 exit 0

6.) Save the file and try to start the HEPIPE service service hepipe start

The hepipe service starts now automatically on boot up and shows status if running or not if you type in service --status-all

Clone this wiki locally