-
-
Save No9/44a96dbbee9e47dc8104c5afe53be56d to your computer and use it in GitHub Desktop.
A set of files to act as a template for running a PM2 job in a jail
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
#!/bin/sh | |
# PROVIDE: blog | |
# Save this into /usr/local/etc/rc.d/blog | |
# Make sure it's executable and validate with | |
# /usr/local/etc/rc.d/blog rcvar | |
# This will allow you to stop and start the service with: | |
# service blog restart | |
. /etc/rc.subr | |
name="blog" | |
rcvar=blog_enable | |
start_cmd="${name}_start" | |
stop_cmd="${name}_stop" | |
load_rc_config $name | |
PATH=$PATH:/usr/local/bin | |
export PM2_HOME=/root/.pm2 | |
blog_start() | |
{ | |
if checkyesno ${rcvar}; then | |
/usr/local/bin/pm2 start path/to/index.js --name "blog" | |
fi | |
} | |
blog_stop() | |
{ | |
pm2 stop blog | |
} | |
run_rc_command "$1" |
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
# Save this as /usr/local/etc/rc.conf | |
blog_enable="YES" |
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
#!/bin/sh | |
# make sure this file executable | |
/usr/local/etc/rc.d/blog start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment