swee revised this gist 4 days ago. Go to revision
1 file changed, 32 insertions
thelounge(file created)
| @@ -0,0 +1,32 @@ | |||
| 1 | + | #!/bin/sh | |
| 2 | + | ||
| 3 | + | # PROVIDE: thelounge | |
| 4 | + | # REQUIRE: networking | |
| 5 | + | # KEYWORD: shutdown | |
| 6 | + | ||
| 7 | + | . /etc/rc.subr | |
| 8 | + | ||
| 9 | + | name="thelounge" | |
| 10 | + | rcvar="thelounge_enable" | |
| 11 | + | start_precmd="thelounge_precmd" | |
| 12 | + | procname="/usr/local/bin/node" | |
| 13 | + | pidfile="/var/run/${name}.pid" | |
| 14 | + | ||
| 15 | + | load_rc_config $name | |
| 16 | + | ||
| 17 | + | : ${thelounge_enable:="NO"} | |
| 18 | + | : ${thelounge_home:="/usr/local/etc/thelounge"} | |
| 19 | + | : ${thelounge_user:="thelounge"} | |
| 20 | + | ||
| 21 | + | export THELOUNGE_HOME=${thelounge_home} | |
| 22 | + | ||
| 23 | + | command="/usr/sbin/daemon" | |
| 24 | + | command_args="-f -p ${pidfile} /usr/local/bin/node /usr/local/bin/thelounge start" | |
| 25 | + | ||
| 26 | + | thelounge_precmd() { | |
| 27 | + | if [ ! -e "${pidfile}" ]; then | |
| 28 | + | install -o "${thelounge_user}" -g "wheel" "/dev/null" "${pidfile}" | |
| 29 | + | fi | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | run_rc_command "$1" | |
Newer
Older