Last active
August 14, 2016 22:34
-
-
Save digizeph/0777860d0444653ba50d79e8db8ba252 to your computer and use it in GitHub Desktop.
rc.d service script for Ghost blogging platform. Change the GHOST and FOREVER parameter to the paths of your own setup.
This file contains hidden or 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 | |
| #### | |
| # Ghost blogging rc.d service script. | |
| # -Mingwei Zhang (mingwei@mwzhang.com) | |
| #### | |
| PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin | |
| . /etc/rc.subr | |
| name="ghost" | |
| rcvar="ghost_enable" | |
| extra_commands="status" | |
| start_cmd="${name}_start" | |
| stop_cmd="${name}_stop" | |
| restart_cmd="${name}_restart" | |
| status_cmd="ghost_status" | |
| GHOST="/root/ghost-current" | |
| FOREVER="/usr/local/bin/forever" | |
| ghost_start() | |
| { | |
| echo "Stoppping all other running forever instances" | |
| ${forever_location} stopall | |
| echo "Starting Ghost blog forever instance" | |
| NODE_ENV=production ${FOREVER} start ${GHOST}/index.js | |
| } | |
| ghost_restart() | |
| { | |
| echo "Stoppping all other running forever instances" | |
| ${FOREVER} stopall | |
| echo "Starting Ghost blog forever instance" | |
| NODE_ENV=production ${FOREVER} start ${GHOST}/index.js | |
| } | |
| ghost_stop() | |
| { | |
| echo "Stoppping all other running forever instances" | |
| ${FOREVER} stopall | |
| } | |
| ghost_status() | |
| { | |
| ${FOREVER} list | |
| } | |
| load_rc_config ${name} | |
| : ${ghost_enable:=NO} | |
| run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment