FreeBSD init
commit 0bd182ebb5d9da183d7d3950c77418cf02dd8706 Merge:5fac3d7dadbd0f Author: Ruud <ruud@crashdummy.nl> Date: Thu May 31 20:21:17 2012 +0200 Merge branch 'master' of https://github.com/jallakim/CouchPotatoServer into jallakim-master Conflicts: init/freebsd commit5fac3d708dMerge:0ba2e5795e5282Author: Ruud <ruud@crashdummy.nl> Date: Thu May 31 19:30:18 2012 +0200 Merge branch 'refs/heads/develop' commit dadbd0f1fd61fe6c8a233b823bbf4ed29a9032f0 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 22:35:27 2012 +0200 Useless Use of Cat Award (-: commit 9fe11355a9671a1f38a6b982b50034f075c34b8d Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 22:30:26 2012 +0200 Ooops. PORT and CPAPI got mixed around in FreeBSD init-script. commit e39be8970ca0a4365ff15e6d8b3d64864c2bbdc4 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 22:25:46 2012 +0200 Cosmetics again. commit 5cca98db31caaf6ca7032a3d948c4feb6ca30e2e Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 22:22:54 2012 +0200 Check that settings.conf exists in FreeBSD init-script commit d1e98602d8d86200431ff1d109d89853fb6ea243 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 22:16:47 2012 +0200 FreeBSD init-script fetches variables from CP's settings.conf commit 42dbe607cfeca13efc76e6db7c5df4907bf7fc80 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 16:02:46 2012 +0200 Should work for all FreeBSD versions now. commit f0bcf6a0f5c401a1f96f98ef35b82c3e45f05e11 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 15:17:53 2012 +0200 Don't 'import sys' before we need it commit 8e13fcd0d137e304b5c49aaec4397ca58c2ef431 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 15:09:58 2012 +0200 Cosmetics! (-: commit 04af454c0362dcabb1cec06863f1defabf7a3736 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 15:05:32 2012 +0200 Added /data/ to .gitignore Used as data-dir if CouchPotato is installed on FreeBSD. commit 055d47d7b4a9401fcab1e4cdb319c3e95a91e1ca Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 15:04:36 2012 +0200 Fixed getDataDir so that it works for FreeBSD9. Assumes that '/usr/local/couchpotato/' is where CouchPotato resides. commit 4859f1b9f23e1d994e7fca24e25bae0226717006 Author: Joachim Tingvold <joachim@tingvold.com> Date: Wed May 30 15:03:26 2012 +0200 Fixed the FreeBSD init-script. commit0ba2e579f9Merge:fdf0d2da2a3896Author: Ruud <ruud@crashdummy.nl> Date: Sun May 20 23:50:54 2012 +0200 Merge branch 'master' of github.com:RuudBurger/CouchPotatoServer commitfdf0d2d5b4Author: Ruud Burger <ruud@crashdummy.nl> Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master.. commita2a3896b1fMerge:5017b0119640a9Author: Ruud <ruud@crashdummy.nl> Date: Sun May 20 19:57:05 2012 +0200 Merge branch 'refs/heads/develop' commit5017b01934Merge:d4a5483f2f524cAuthor: Ruud <ruud@crashdummy.nl> Date: Tue May 15 23:23:25 2012 +0200 Merge branch 'master' of github.com:RuudBurger/CouchPotatoServer commitd4a5483fa0Author: Ruud Burger <ruud@crashdummy.nl> Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master.. commitf2f524c4e4Merge:577aed3edbeb02Author: Ruud <ruud@crashdummy.nl> Date: Tue May 15 23:16:12 2012 +0200 Merge branch 'refs/heads/develop' commit577aed3a75Merge:cb975f6176f4b0Author: Ruud <ruud@crashdummy.nl> Date: Mon May 14 23:36:53 2012 +0200 Merge branch 'refs/heads/develop' commitcb975f6180Merge:3e369c5a71fb1aAuthor: Ruud <ruud@crashdummy.nl> Date: Mon May 14 20:23:05 2012 +0200 Merge branch 'refs/heads/develop' commit3e369c5838Merge:d89130d0847ffdAuthor: Ruud <ruud@crashdummy.nl> Date: Sun May 13 12:56:37 2012 +0200 Merge branch 'refs/heads/develop' commitd89130dc30Merge:ee5e1d1c34f392Author: Ruud <ruud@crashdummy.nl> Date: Sat May 12 00:36:03 2012 +0200 Merge branch 'refs/heads/develop' commitee5e1d19d1Merge:7d2eb23b2be9efAuthor: Ruud <ruud@crashdummy.nl> Date: Wed May 9 22:19:29 2012 +0200 Merge branch 'refs/heads/develop' commit7d2eb2376fMerge:40ff984ba8fef3Author: Ruud Burger <ruud@crashdummy.nl> Date: Mon May 7 13:35:13 2012 -0700 Merge pull request #228 from sirchia/twitterDirectMessage Added support for direct messages in twitter notifications commit40ff984e19Merge:1f3e22c7ca509cAuthor: Ruud <ruud@crashdummy.nl> Date: Mon May 7 22:26:55 2012 +0200 Merge branch 'refs/heads/develop' commitba8fef3c87Author: Riccardo Sirchia <sirchia.r@gmail.com> Date: Sun May 6 18:02:51 2012 +0200 Added support for direct messages in twitter notifications commit1f3e22c4edMerge:89315cb74226f0Author: Ruud <ruud@crashdummy.nl> Date: Fri May 4 17:27:36 2012 +0200 Merge branch 'refs/heads/develop' commit89315cb291Merge:829b3cff6de117Author: Ruud <ruud@crashdummy.nl> Date: Fri May 4 17:27:12 2012 +0200 Merge branch 'refs/heads/develop' commit829b3cfb3bMerge:e3cc15d1345e98Author: Ruud <ruud@crashdummy.nl> Date: Wed May 2 21:40:01 2012 +0200 Merge branch 'refs/heads/develop' commite3cc15d2b6Merge:ca87f2cc161bddAuthor: Ruud <ruud@crashdummy.nl> Date: Sun Apr 29 00:00:14 2012 +0200 Merge branch 'refs/heads/develop' commitca87f2c231Merge:e929af7c7bc0f4Author: Ruud <ruud@crashdummy.nl> Date: Sat Apr 28 23:14:18 2012 +0200 Merge branch 'refs/heads/develop' commite929af76d0Merge:b22763bd1c2869Author: Ruud Burger <ruud@crashdummy.nl> Date: Fri Apr 27 02:04:35 2012 -0700 Merge pull request #152 from garlandkr/master Removed group setting for init commitd1c2869f2cAuthor: Ken Garland <garlandkr@gmail.com> Date: Thu Apr 26 23:30:33 2012 -0300 Removed RUN_AS for group, don't assume the default group is the same as the username. Specifying group is not needed anyways. commitb22763b37dAuthor: Ruud Burger <ruud@crashdummy.nl> Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master..
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/_source/
|
||||
/_source/
|
||||
/data/
|
||||
|
||||
@@ -5,6 +5,7 @@ import platform
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
@@ -22,6 +23,10 @@ def getDataDir():
|
||||
if 'darwin' in platform.platform().lower():
|
||||
return os.path.join(user_dir, 'Library', 'Application Support', 'CouchPotato')
|
||||
|
||||
# FreeBSD
|
||||
if 'freebsd' in sys.platform:
|
||||
return os.path.join('/usr/local/', 'couchpotato', 'data')
|
||||
|
||||
# Linux
|
||||
return os.path.join(user_dir, '.couchpotato')
|
||||
|
||||
|
||||
29
init/freebsd
29
init/freebsd
@@ -31,14 +31,27 @@ load_rc_config ${name}
|
||||
: ${couchpotato_user:="_sabnzbd"}
|
||||
: ${couchpotato_dir:="/usr/local/couchpotato"}
|
||||
: ${couchpotato_chdir:="${couchpotato_dir}"}
|
||||
: ${couchpotato_pid:="/var/run/couchpotato.pid"}
|
||||
: ${couchpotato_pid:="${couchpotato_dir}/couchpotato.pid"}
|
||||
: ${couchpotato_conf:="${couchpotato_dir}/data/settings.conf"}
|
||||
|
||||
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown CouchPotato.
|
||||
if [ -e "${couchpotato_conf}" ]; then
|
||||
HOST=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^host"|perl -wple 's/^host = (.*)$/$1/'`
|
||||
PORT=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^port"|perl -wple 's/^port = (.*)$/$1/'`
|
||||
CPAPI=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^api_key"|perl -wple 's/^api_key = (.*)$/$1/'`
|
||||
fi
|
||||
|
||||
pidfile="${couchpotato_pid}"
|
||||
status_cmd="${name}_status"
|
||||
stop_cmd="${name}_stop"
|
||||
|
||||
command="/usr/sbin/daemon"
|
||||
command_args="-f -p ${couchpotato_pid} python ${couchpotato_dir}/CouchPotato.py ${couchpotato_flags} --pid_file=${couchpotato_pid}"
|
||||
command_args="-f -p ${couchpotato_pid} python ${couchpotato_dir}/CouchPotato.py ${couchpotato_flags}"
|
||||
|
||||
# Check for wget and refuse to start without it.
|
||||
if [ ! -x "${WGET}" ]; then
|
||||
warn "couchpotato not started: You need wget to safely shut down CouchPotato."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure user is root when running this script.
|
||||
if [ `id -u` != "0" ]; then
|
||||
@@ -55,17 +68,17 @@ 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
|
||||
if [ -n "${pid}" ]; then
|
||||
kill -SIGTERM ${pid} 2> /dev/null
|
||||
wait_for_pids ${pid}
|
||||
kill -9 ${pid} 2> /dev/null
|
||||
echo "Stopped"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
couchpotato_status() {
|
||||
|
||||
Reference in New Issue
Block a user