Browse Source

Check that settings.conf exists in FreeBSD init-script

pull/381/head
Joachim Tingvold 13 years ago
parent
commit
5cca98db31
  1. 12
      init/freebsd

12
init/freebsd

@ -35,9 +35,11 @@ load_rc_config ${name}
: ${couchpotato_conf:="${couchpotato_dir}/data/settings.conf"}
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown CouchPotato.
HOST=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^host"|perl -wple 's/^host = (.*)$/$1/'`
PORT=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^api_key"|perl -wple 's/^api_key = (.*)$/$1/'`
CPAPI=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^port"|perl -wple 's/^port = (.*)$/$1/'`
if [ -e "${couchpotato_conf}" ]; then
HOST=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^host"|perl -wple 's/^host = (.*)$/$1/'`
PORT=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^api_key"|perl -wple 's/^api_key = (.*)$/$1/'`
CPAPI=`cat "${couchpotato_conf}"|grep -A14 "\[core\]"|egrep "^port"|perl -wple 's/^port = (.*)$/$1/'`
fi
status_cmd="${name}_status"
stop_cmd="${name}_stop"
@ -66,6 +68,10 @@ verify_couchpotato_pid() {
# Try to stop CouchPotato cleanly by calling shutdown over http.
couchpotato_stop() {
if [ ! -e "${couchpotato_conf}" ]; then
echo "CouchPotato's settings file does not exist. Try starting CouchPotato, as this should create the file."
exit 1
fi
echo "Stopping $name"
verify_couchpotato_pid
${WGET} -O - -q "http://${HOST}:${PORT}/api/${CPAPI}/app.shutdown/" >/dev/null

Loading…
Cancel
Save