Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Amazon Linux startup script
Script is based heavily off of the CentOS/Redhat script, with the calls to super removed.
- Loading branch information
1 parent
792015e
commit 602677f
Showing
3 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
# | ||
# pm2 Process manager for NodeJS | ||
# | ||
# chkconfig: 345 80 20 | ||
# | ||
# description: PM2 next gen process manager for Node.js | ||
# processname: pm2 | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: pm2 | ||
# Required-Start: $local_fs $remote_fs | ||
# Required-Stop: $local_fs $remote_fs | ||
# Should-Start: $network | ||
# Should-Stop: $network | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: PM2 init script | ||
# Description: PM2 is the next gen process manager for Node.js | ||
### END INIT INFO | ||
|
||
NAME=pm2 | ||
PM2=%PM2_PATH% | ||
USER=%USER% | ||
|
||
export PATH=$PATH:%NODE_PATH% | ||
export HOME="%HOME_PATH%" | ||
|
||
lockfile="/var/lock/subsys/pm2-init.sh" | ||
|
||
start() { | ||
echo "Starting $NAME" | ||
$PM2 resurrect | ||
retval=$? | ||
[ $retval -eq 0 ] && touch $lockfile | ||
} | ||
|
||
stop() { | ||
echo "Stopping $NAME" | ||
$PM2 dump | ||
$PM2 delete all | ||
$PM2 kill | ||
rm -f $lockfile | ||
} | ||
|
||
restart() { | ||
echo "Restarting $NAME" | ||
stop | ||
start | ||
} | ||
|
||
reload() { | ||
echo "Reloading $NAME" | ||
$PM2 reload all | ||
} | ||
|
||
status() { | ||
echo "Status for $NAME:" | ||
$PM2 list | ||
RETVAL=$? | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status | ||
;; | ||
restart) | ||
restart | ||
;; | ||
reload) | ||
reload | ||
;; | ||
*) | ||
echo "Usage: {start|stop|status|restart|reload}" | ||
exit 1 | ||
;; | ||
esac | ||
exit $RETVAL |