Snippets

idontwatchtv Ghost rc script for FreeBSD

Created by Justin C

File ghost Added

  • Ignore whitespace
  • Hide word diff
+#!/bin/sh
+
+# PROVIDE: ghost
+# REQUIRE: mysql-server
+# KEYWORD: shutdown
+
+PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
+
+. /etc/rc.subr
+
+name="ghost"
+rcvar="ghost_enable"
+
+load_rc_config ghost
+: ${ghost_enable:="NO"}
+: ${ghost_msg="Ghost did not start"}
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+stop_postcmd="echo Ghost stopped"
+restart_cmd="${name}_restart"
+required_dirs="$ghost_path"
+
+ghost_start() {
+    sudo -H -u ghost sh -c "cd $ghost_path && ghost start"
+}
+
+ghost_stop() {
+    sudo -H -u ghost sh -c "cd $ghost_path && ghost stop"
+}
+
+ghost_restart() {
+    sudo -H -u ghost sh -c "cd $ghost_path && ghost restart"
+}
+
+run_rc_command "$1"
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.