-
-
Notifications
You must be signed in to change notification settings - Fork 28
pastash service
Lorenzo Mangani edited this page Mar 24, 2020
·
18 revisions
sudo npm install -g @pastash/pastash
git clone https://github.com/sipcapture/pastash/
cd pastash
npm install
note: optional plugins might fail to install in npm without their requirements libraries (libzmq, etc)
Install add-to-systemd
utility with npm
npm install -g add-to-systemd
Add a pastash service to systemd (will start it on boot)
add-to-systemd my-pastash-service "$(which pastash) --config_file=/path/to/my-pastash.conf"
Use systemctl to manage the service
systemctl start my-pastash-service
npm install -g pm2
apps:
- script : bin/pastash
name: 'pastash-logs'
args: ['--config_file=/opt/pastash.conf']
pm2 start /path/to/pastash.yml
pm2 save
pm2 startup
sudo npm install -g forever
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
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
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.
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