Skip to content

pastash service

Lorenzo Mangani edited this page Sep 25, 2017 · 18 revisions

Installation

PaStash can be built and installed with npm.

NPM Install

sudo npm install -g pastash

GIT Install

git clone https://github.com/sipcapture/pastash/
cd pastash
npm install

Running as Service

PM2

Install PM2

npm install -g pm2

Create a custom yml file

apps:
  - script   : bin/pastash
    args: ['--config_file=/opt/pastash.conf']

Launch using PM2

pm2 start /path/to/pastash.yml

FOREVER

Install forever:

sudo npm install -g forever

Start Service

forever start pastash --config_file=/path/to/pastash.conf

Forever restarts your app when it crashes or stops for some reason. To restrict restarts to 5 you could use:

forever -m5 pastash --config_file=/path/to/pastash.conf

Manage Services:

forever list

Note the integer in the brackets and use it as following to stop a process:

forever stop 0

Restarting a running process goes:

forever restart 0

UPSTART

This sample upstart script will handle respawning paStash in the event that it crashes. It will give up attempts to respawn your application if it crashes 3 or more times in less than 15 seconds.

/etc/init/pastash_daemon.conf
description "paSTash Daemon"
author      "QXIP"

stop on shutdown

respawn
respawn limit 3 15

script
  export APP_HOME="/usr/src/pastash"
  cd $APP_HOME
  exec sudo -u user /usr/bin/node /usr/local/bin/pastash --config_dir=/opt/pastash/configs
end script
Clone this wiki locally