mirror of
https://github.com/rembo10/headphones.git
synced 2026-01-10 07:17:59 -05:00
This path is incorrect for freebsd the path to python bin is /usr/local/bin/python rather than /usr/bin/python
51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# PROVIDE: headphones
|
|
# REQUIRE: DAEMON
|
|
# BEFORE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# headphones_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable it.
|
|
# headphones_user: The user account Headphones daemon runs as what
|
|
# you want it to be. It uses '_sabnzbd' user by
|
|
# default. Do not sets it as empty or it will run
|
|
# as root.
|
|
# headphones_dir: Directory where Headphones lives.
|
|
# Default: /usr/local/headphones
|
|
# headphones_pid: The name of the pidfile to create.
|
|
# Default is headphones.pid in headphones_dir.
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="headphones"
|
|
rcvar=${name}_enable
|
|
load_rc_config ${name}
|
|
|
|
: "${headphones_enable:="NO"}"
|
|
: "${headphones_user:="_sabnzbd"}"
|
|
: "${headphones_dir:="/usr/local/headphones"}"
|
|
: "${headphones_conf:="/usr/local/headphones/config.ini"}"
|
|
|
|
command="${headphones_dir}/Headphones.py"
|
|
command_interpreter="/usr/local/bin/python"
|
|
pidfile="/var/run/headphones/headphones.pid"
|
|
start_precmd="headphones_start_precmd"
|
|
headphones_flags="--daemon --nolaunch --pidfile $pidfile --config $headphones_conf $headphones_flags"
|
|
|
|
headphones_start_precmd() {
|
|
if [ $($ID -u) != 0 ]; then
|
|
err 1 "Must be root."
|
|
fi
|
|
|
|
if [ ! -d /var/run/headphones ]; then
|
|
install -do $headphones_user /var/run/headphones
|
|
fi
|
|
}
|
|
|
|
load_rc_config ${name}
|
|
run_rc_command "$1"
|