#!/bin/sh # # PROVIDE: couchpotato # REQUIRE: LOGIN # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable couchpotato: # couchpotato_enable: Set to NO by default. Set it to YES to enable it. # couchpotato_user: The user account CouchPotato daemon runs as what # you want it to be. # couchpotato_dir: Directory where CouchPotato lives. # Default: /usr/local/CouchPotatoServer # couchpotato_datadir: Directory where CouchPotato user data lives. # Default: $couchpotato_dir/data # couchpotato_conf: Directory where CouchPotato user data lives. # Default: $couchpotato_datadir/settings.conf # couchpotato_pid: Full path to PID file. # Default: $couchpotato_datadir/couchpotato.pid # couchpotato_flags: Set additonal flags as needed. . /etc/rc.subr name="couchpotato" rcvar=couchpotato_enable load_rc_config ${name} : ${couchpotato_enable:=NO} : ${couchpotato_user:=} #default is root : ${couchpotato_dir:=/usr/local/CouchPotatoServer} : ${couchpotato_datadir:=${couchpotato_dir}/data} : ${couchpotato_conf:=} #default is datadir/settings.conf : ${couchpotato_pid:=} #default is datadir/couchpotato.pid : ${couchpotato_flags:=} command="${couchpotato_dir}/CouchPotato.py" command_interpreter="/usr/local/bin/python" command_args="--daemon --data_dir ${couchpotato_datadir}" # append optional flags if [ -n "${couchpotato_pid}" ]; then pidfile=${couchpotato_pid} couchpotato_flags="${couchpotato_flags} --pid_file ${couchpotato_pid}" fi if [ -n "${couchpotato_conf}" ]; then couchpotato_flags="${couchpotato_flags} --config_file ${couchpotato_conf}" fi run_rc_command "$1"