- Modifié
Pour le tuto http://mondedie.fr/d/7475
N'hésitez pas pour toutes remarques, suggestions, erreurs trouvées, si je ne réponds pas à vos questions sur le sujet, n'hésitez pas à m'envoyer un MP.
Je pensais que vous connaissiez, j'ai vu pas mal de posts dessus ici.Solinvictus wrote:Merci pour la découverte nami !
j'ai fait un screen exprès:xataz wrote:Salut,
Headphones à t'il évolué en terme de providers connu, car à l'époque ou je l'avais testé, il n'avais aucun tracker Français ou connu par moi.
Au final après arret de headphone puis une ballade au soleil rutorrent remarche !!! ...nami007 wrote:Salut, pour qu'on puisse vraiment t'aider, il nous faudrait les logs rutorrent, les logs headphones, ton rutorrent.conf et ton headphones.conf
<body> <h1>An error occurred.</h1> <p>Sorry, the page you are looking for is currently unavailable.<br/> Please try again later.</p> <p>If you are the system administrator of this resource then you should check the <a href="http://nginx.org/r/error_log">error log</a> for details.</p> <p><em>Faithfully yours, nginx.</em></p> </body> </html>
Note : j'ai choisi le port 8082 pour headphone qui suit le port de sickrage 8081.2015/12/13 13:26:06 [error] 17211#17211: *53576 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:26:21 [error] 17211#17211: *53589 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:26:27 [error] 17211#17211: *53584 open() "/var/www/rutorrent/favicon.ico" failed (2: No such file or directory), client: 78.245.88.44, server: _, request:
"GET /rutorrent/favicon.ico HTTP/1.1", host: "serveur.domaine"
2015/12/13 13:27:09 [error] 17211#17211: *53617 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:27:12 [error] 17211#17211: *53617 open() "/var/www/rutorrent/favicon.ico" failed (2: No such file or directory), client: 78.245.88.44, server: _, request:
"GET /rutorrent/favicon.ico HTTP/1.1", host: "serveur.domaine"
2015/12/13 13:27:21 [error] 17211#17211: *53617 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:27:24 [error] 17211#17211: *53618 open() "/var/www/rutorrent/favicon.ico" failed (2: No such file or directory), client: 78.245.88.44, server: _, request:
"GET /rutorrent/favicon.ico HTTP/1.1", host: "serveur.domaine"
2015/12/13 13:29:22 [error] 17211#17211: *53617 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:31:22 [error] 17211#17211: *53726 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 13:33:22 [error] 17211#17211: *53726 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server:
_, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 14:18:54 [error] 10130#10130: *3 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server: _,
request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 14:19:30 [error] 10130#10130: *41 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server: _,
request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 14:21:50 [error] 10130#10130: *128 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 78.245.88.44, server: _
, request: "POST /EDDIE HTTP/1.1", upstream: "scgi://127.0.0.1:5001", host: "serveur.domaine", referrer: "[url]http://serveur.domaine/rutorrent/[/url]"
2015/12/13 14:21:53 [error] 10130#10130: *127 open() "/var/www/rutorrent/favicon.ico" failed (2: No such file or directory), client: 78.245.88.44, server: _, request: "
GET /rutorrent/favicon.ico HTTP/1.1", host: "serveur.domaine"
Headphone.log
13-Dec-2015 18:34:03 - INFO :: CP Server Thread-11 : Parsing results from Mininova
13-Dec-2015 18:34:03 - INFO :: CP Server Thread-11 : No results found from Mininova for Christine and the Queens Chaleur humaine
13-Dec-2015 18:34:03 - INFO :: CP Server Thread-11 : No appropriate matches found for Christine and the Queens - Chaleur humaine
13-Dec-2015 18:34:03 - INFO :: CP Server Thread-11 : Search for wanted albums complete
13-Dec-2015 18:35:34 - INFO :: CP Server Thread-8 : Searching for wanted albums
13-Dec-2015 18:35:34 - INFO :: CP Server Thread-8 : Searching for "Christine and the Queens - Chaleur humaine"
13-Dec-2015 18:35:34 - INFO :: CP Server Thread-8 : Searching Kick Ass Torrents using term: Christine and the Queens Chaleur humaine
13-Dec-2015 18:35:35 - INFO :: CP Server Thread-8 : Christine And The Queens - Chaleur Humaine - 2015 - EAC is larger than the maxsize, the wrong format or has too l
ittle seeders for this category, skipping. (Size: 479141444 bytes, Seeders: 15, Format: True)
13-Dec-2015 18:35:35 - INFO :: CP Server Thread-8 : Searching The Pirate Bay using term: Christine and the Queens Chaleur humaine
13-Dec-2015 18:35:37 - INFO :: CP Server Thread-8 : "Christine and the Queens - Chaleur humaine (2014)" only has a magnet link, skipping
13-Dec-2015 18:35:37 - INFO :: CP Server Thread-8 : Parsing results from Old Pirate Bay
13-Dec-2015 18:35:37 - ERROR :: CP Server Thread-8 : Request raised exception: Invalid URL u'/search.php?q=Christine+and+the+Queens+Chaleur+humaine&iht=6': No schema
supplied. Perhaps you meant http:///search.php?q=Christine+and+the+Queens+Chaleur+humaine&iht=6?
13-Dec-2015 18:35:37 - INFO :: CP Server Thread-8 : Searching Strike using term: Christine and the Queens Chaleur humaine
13-Dec-2015 18:35:37 - ERROR :: CP Server Thread-8 : Unhandled exception in the Strike parser
Traceback (most recent call last):
File "/opt/headphones/headphones/searcher.py", line 1559, in searchTorrent
url = item['magnet_uri']
KeyError: 'magnet_uri'
13-Dec-2015 18:35:37 - INFO :: CP Server Thread-8 : Parsing results from Mininova
13-Dec-2015 18:35:37 - INFO :: CP Server Thread-8 : No results found from Mininova for Christine and the Queens Chaleur humaine
13-Dec-2015 18:35:45 - INFO :: CP Server Thread-5 : Making sure we can download the chosen result
13-Dec-2015 18:35:46 - INFO :: CP Server Thread-5 : Found best result from Kick Ass Torrents: <a href="https://torcache.net/torrent/E5937E058C102A668F64C1BEBFA5D5146
391FF12.torrent?title=[kat.cr]christine.and.the.queens.chaleur.humaine.2015.eac">Christine And The Queens - Chaleur Humaine - 2015 - EAC</a> - 456.0 MB
13-Dec-2015 18:35:46 - ERROR :: CP Server Thread-5 : Could not write torrent file '/home/eddie/watch/music/Christine and the Queens - Chaleur humaine [2014].torrent':
. Skipping.
rutorrent.conf
server {
listen 80 default_server;
listen 443 default_server ssl http2;
server_name _;
index index.html index.php;
charset utf-8;
client_max_body_size 10M;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
include /etc/nginx/conf.d/ciphers.conf;
access_log /var/log/nginx/rutorrent-access.log combined;
error_log /var/log/nginx/rutorrent-error.log error;
error_page 500 502 503 504 /50x.html;
location = /50x.html { root /usr/share/nginx/html; }
auth_basic "seedbox";
auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";
location = /favicon.ico {
access_log off;
log_not_found off;
}
## début config accueil serveur ##
location ^~ / {
root /var/www/base;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
satisfy any;
allow all;
}
## fin config accueil serveur ##
## début config proxy ##
location ^~ /proxy {
root /var/www;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
## fin config proxy ##
## début config rutorrent ##
location ^~ /rutorrent {
root /var/www;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
location ~ /\.svn {
deny all;
}
location ~ /\.ht {
deny all;
}
}
location ^~ /rutorrent/conf/ {
deny all;
}
location ^~ /rutorrent/share/ {
deny all;
}
## fin config rutorrent ##
## début config munin ##
location ^~ /graph {
root /var/www;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
location ^~ /graph/img {
root /var/www;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
error_log /dev/null crit;
}
location ^~ /monitoring {
root /var/www;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
## fin config munin ##
## début config seedbox-manager ##
location ^~ /seedbox-manager {
alias /var/www/seedbox-manager/public;
include /etc/nginx/conf.d/php-manager.conf;
include /etc/nginx/conf.d/cache.conf;
}
## fin config seedbox-manager ##
## config utilisateurs ##
location /EDDIE {
include scgi_params;
scgi_pass 127.0.0.1:5001; #ou socket : unix:/home/username/.session/username.socket
auth_basic "seedbox";
auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_eddie";
}
location /PIRATE1 {
include scgi_params;
scgi_pass 127.0.0.1:5003; #ou socket : unix:/home/username/.session/username.socket
auth_basic "seedbox";
auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_pirate1";
}
## debut config cakebox-light ##
location /cakebox/ {
rewrite ^/cakebox(/.*)$ $1 break;
proxy_pass http://127.0.0.1:81;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
}
location /cakebox/eddie/ {
alias /home/eddie/video/;
add_header Content-Disposition "attachment";
satisfy any;
allow all;
}
location /cakebox/pirate1/ {
alias /home/pirate1/video/;
add_header Content-Disposition "attachment";
satisfy any;
allow all;
}
## etc si d'autre utilisateur ##
## fin config cakebox-light ##
}
/etc/defaut/headphone
HP_USER=headphones #$RUN_AS, username to run headphones under, the default is headphones
HP_HOME=/opt/headphones #$APP_PATH, the location of Headphones.py, the default is /opt/headphones
HP_DATA=/opt/headphones #$DATA_DIR, the location of headphones.db, cache, logs, the default is /opt/headphones
/opt/headphone/config.ini
[General]
nzb_downloader = 0
cue_split = 1
libraryscan = 1
music_encoder = 0
open_magnet_links = 0
preferred_quality = 0
customport = 5000
download_scan_interval = 5
preferred_bitrate = ""
destination_dir = /home/eddie/music
encodervbrcbr = cbr
xldprofile = ""
delete_lossless_files = 1
encoderquality = 2
autowant_all = 0
ignored_words = ""
freeze_db = 0
encoder_multicore_count = 0
keep_torrent_files = 1
http_root = /
download_dir = ""
http_proxy = 0
launch_browser = 1
http_username = ""
lossless_destination_dir = ""
mb_ignore_age = 365
file_underscores = 0
cue_split_flac_path = ""
lossless_bitrate_from = 0
do_not_override_git_branch = 0
include_extras = 0
samplingfrequency = 44100
http_host = 0.0.0.0
album_art_format = folder
encoder_path = ""
hpuser = ""
detect_bitrate = 0
enable_https = 0
check_github = 1
custompass = ""
mirror = musicbrainz.org
api_enabled = 0
correct_metadata = 1
customuser = ""
cue_split_shntool_path = ""
do_not_process_unmatched = 0
lastfm_username = ""
autowant_upcoming = 1
config_version = 5
check_github_interval = 360
customauth = 0
file_permissions = 0644
prefer_torrents = 1
encoderoutputformat = mp3
search_interval = 1440
preferred_bitrate_low_buffer = 0
ignore_clean_releases = 0
http_password = ""
usenet_retention = 1500
add_album_art = 1
headphones_indexer = 0
wait_until_release_date = 0
rename_files = 1
file_format = $Track $Artist - $Album [$Year] - $Title
customhost = gloubiboulga.tk
interface = default
folder_format = $Artist/$Album [$Year]
move_files = 1
cleanup_files = 0
replace_existing_folders = 1
preferred_bitrate_allow_lossless = 0
embed_album_art = 0
check_github_on_startup = 1
http_port = 8082
download_torrent_dir = /home/eddie/torrents/Done/music
folder_permissions = 0755
official_releases_only = 0
magnet_links = 0
log_dir = /opt/headphones/logs
update_db_interval = 24
git_path = ""
required_words = ""
advancedencoder = ""
numberofseeders = 10
torrentblackhole_dir = /home/eddie/watch/music
cache_dir = /opt/headphones/cache
blackhole = 0
libraryscan_interval = 300
keep_nfo = 0
preferred_bitrate_high_buffer = 0
https_cert = /opt/headphones/server.crt
hppass = ""
customsleep = 1
api_key = ""
encoderlossless = 1
torrent_downloader = 0
torrent_removal_interval = 720
blackhole_dir = ""
keep_original_folder = 0
extras = ""
autowant_manually_added = 1
encoder_multicore = 0
encoderfolder = ""
preferred_words = ""
https_key = /opt/headphones/server.key
encoder = ffmpeg
git_user = rembo10
bitrate = 192
music_dir = /home/eddie/music
auto_add_artists = 1
git_branch = master
embed_lyrics = 1
lossless_bitrate_to = 0
[Growl]
growl_enabled = 0
growl_onsnatch = 0
growl_host = ""
growl_password = ""
[Subsonic]
subsonic_host = ""
subsonic_password = ""
subsonic_enabled = 0
subsonic_username = ""
[Waffles]
waffles_passkey = ""
waffles = 0
waffles_uid = ""
waffles_ratio = ""
[Email]
email_onsnatch = 0
email_smtp_password = ""
email_tls = 0
email_smtp_port = 25
email_smtp_server = ""
email_enabled = 0
email_smtp_user = ""
email_ssl = 0
email_to = ""
email_from = ""
[Plex]
plex_token = ""
plex_client_host = ""
plex_notify = 0
plex_update = 0
plex_username = ""
plex_password = ""
plex_server_host = ""
plex_enabled = 0
[Old Piratebay]
oldpiratebay = 1
oldpiratebay_ratio = ""
oldpiratebay_url = ""
[Pushover]
pushover_apitoken = ""
pushover_onsnatch = 0
pushover_enabled = 0
pushover_keys = ""
pushover_priority = 0
[NZBget]
nzbget_priority = 0
nzbget_password = ""
nzbget_host = ""
nzbget_category = ""
nzbget_username = nzbget
[NZBsorg]
nzbsorg_hash = ""
nzbsorg = 0
nzbsorg_uid = ""
[NMA]
nma_priority = 0
nma_onsnatch = 0
nma_apikey = ""
nma_enabled = 0
[Advanced]
verify_ssl_cert = 1
ignored_files = ,
journal_mode = wal
album_completion_pct = 80
ignored_folders = ,
cache_sizemb = 32
[Newznab]
newznab = 0
newznab_apikey = ""
newznab_enabled = 1
extra_newznabs = ,
newznab_host = ""
[Prowl]
prowl_onsnatch = 0
prowl_enabled = 0
prowl_priority = 0
prowl_keys = ""
[Twitter]
twitter_prefix = Headphones
twitter_enabled = 0
twitter_username = ""
twitter_password = ""
twitter_onsnatch = 0
[Torznab]
extra_torznabs = ,
torznab_host = ""
torznab_apikey = ""
torznab = 0
torznab_enabled = 1
[SABnzbd]
sab_category = ""
sab_password = ""
sab_host = ""
sab_username = ""
sab_apikey = ""
[Songkick]
songkick_apikey = nd1We7dFW2RqxPw8
songkick_location = ""
songkick_enabled = 1
songkick_filter_enabled = 0
[uTorrent]
utorrent_password = ""
utorrent_host = ""
utorrent_username = ""
utorrent_label = ""
[LMS]
lms_enabled = 0
lms_host = ""
[PushBullet]
pushbullet_deviceid = ""
pushbullet_apikey = ""
pushbullet_enabled = 0
pushbullet_onsnatch = 0
[Pushalot]
pushalot_enabled = 0
pushalot_onsnatch = 0
pushalot_apikey = ""
[Kat]
kat_ratio = ""
kat = 1
kat_proxy_url = ""
[Piratebay]
piratebay_ratio = ""
piratebay = 1
piratebay_proxy_url = ""
[Strike]
strike = 1
strike_ratio = ""
[MPC]
mpc_enabled = 0
[XBMC]
xbmc_username = ""
xbmc_host = ""
xbmc_enabled = 0
xbmc_update = 0
xbmc_password = ""
xbmc_notify = 0
[Beets]
idtag = 0
[Rutracker]
rutracker_user = ""
rutracker_ratio = ""
rutracker = 0
rutracker_password = ""
[Boxcar]
boxcar_onsnatch = 0
boxcar_enabled = 0
boxcar_token = ""
[Transmission]
transmission_password = ""
transmission_username = ""
transmission_host = ""
[Mininova]
mininova = 1
mininova_ratio = ""
[OSX_Notify]
osx_notify_enabled = 0
osx_notify_app = /Applications/Headphones
osx_notify_onsnatch = 0
[What.cd]
whatcd_password = ""
whatcd_username = ""
whatcd = 0
whatcd_ratio = ""
[Synoindex]
synoindex_enabled = 0
[omgwtfnzbs]
omgwtfnzbs = 0
omgwtfnzbs_uid = ""
omgwtfnzbs_apikey = ""
root@root:~# service headphones start
[....] Starting Headphones:/usr/bin/python: can't open file '_OPTS': [Errno 2] No such file or directory
failed!
j'ai cherché un peu sur le net comment faire et j'ai trouvé ce post : --- /etc/init.d/headphones.broken 2015-12-12 01:10:27.888480614 +0100
+++ /etc/init.d/headphones 2015-12-12 01:15:22.316471898 +0100
@@ -164,7 +164,7 @@
handle_updates
if ! is_running; then
log_daemon_msg "Starting $DESC"
- start-stop-daemon -o -d "$APP_PATH" -c "$RUN_AS" --start "$EXTRA_SSD"_OPTS --pidfile "$PID_FILE" --exec "$DAEMON" -- "$DAEMON_OPTS"
+ start-stop-daemon -o -d $APP_PATH -c $RUN_AS --start $EXTRA_SSD_OPTS --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
check_retval
else
log_success_msg "$DESC: already running (pid $PID)"
Est ce que vous pensez que c'est ce qu'il faut faire ?cd ~/headphones
git log
copier la ligne d'une version anterieure git checkout 74e071b1d740464a086ab825e1a3492fc9289c4citr
merci pour la réponse rapide mais je suis debutant mais je me débrouille mais assez bien mais pas pour pour ca j'ai bien installer sickrage pour muti-utilisateur sans problème en suivant ton tuto..xataz wrote:napster_50 :
Le principe est le même que pour sickrage ou couchpotato, faut un fichier init par user.
#!/bin/sh
## HP_USER= #$RUN_AS, username to run headphones under, the default is headphones
## HP_HOME= #$APP_PATH, the location of Headphones.py, the default is /opt/headphones
## HP_DATA= #$DATA_DIR, the location of headphones.db, cache, logs, the default is /opt/headphones
## HP_PIDFILE= #$PID_FILE, the location of headphones.pid, the default is /var/run/headphones/headphones.pid
## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python
## HP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for headphones, i.e. " --config=/home/headphones/config.ini"
## HP_PORT= #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini
##
## EXAMPLE if want to run as different user
## add HP_USER=username to /etc/default/headphones
## otherwise default headphones is used
#
### BEGIN INIT INFO
# Provides: headphones_xataz
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager
# Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Headphones
# Description: starts instance of Headphones using start-stop-daemon
### END INIT INFO
HP_USER=xataz
HP_INSTALL=/opt/headphones
# Pas touche
NAME=headphones_$HP_USER
DESC="Headphones pour $HP_USER"
HP_HOME=$HP_INSTALL
HP_DATA=$HP_HOME/data/$HP_USER
HP_OPTS=--config=$HP_DATA/config.ini
HP_PIDFILE=$HP_DATA/headphones.pid
# App name
SETTINGS_LOADED=FALSE
. /lib/lsb/init-functions
# Source Headphones configuration
if [ -f /etc/default/headphones ]; then
SETTINGS=/etc/default/headphones
else
log_warning_msg "/etc/default/headphones not found using default settings.";
fi
check_retval() {
if [ $? -eq 0 ]; then
log_end_msg 0
return 0
else
log_end_msg 1
exit 1
fi
}
load_settings() {
if [ $SETTINGS_LOADED != "TRUE" ]; then
. $SETTINGS
## The defaults
# Run as username
RUN_AS=${HP_USER-headphones}
# Path to app HP_HOME=path_to_app_Headphones.py
APP_PATH=${HP_HOME-/opt/headphones}
# Data directory where headphones.db, cache and logs are stored
DATA_DIR=${HP_DATA-/opt/headphones}
# Path to store PID file
PID_FILE=${HP_PIDFILE-/var/run/headphones/headphones.pid}
# Path to python bin
DAEMON=${PYTHON_BIN-/usr/bin/python}
# Extra daemon option like: HP_OPTS=" --config=/home/headphones/config.ini"
EXTRA_DAEMON_OPTS=${HP_OPTS-}
# Hardcoded port to run on, overrides config.ini settings
[ -n "$HP_PORT" ] && {
PORT_OPTS=" --port=${HP_PORT} "
}
DAEMON_OPTS=" Headphones.py --quiet --daemon --nolaunch --pidfile=${PID_FILE} --datadir=${DATA_DIR} ${PORT_OPTS}${EXTRA_DAEMON_OPTS}"
SETTINGS_LOADED=TRUE
fi
[ -x "$DAEMON" ] || {
log_warning_msg "$DESC: Can't execute daemon, aborting. See $DAEMON";
return 1;}
return 0
}
load_settings || exit 0
is_running () {
# returns 1 when running, else 0.
if [ -e "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
RET=$?
[ $RET -gt 1 ] && exit 1 || return $RET
else
return 1
fi
}
handle_pid () {
PID_PATH=$(dirname "$PID_FILE")
[ -d "$PID_PATH" ] || mkdir -p "$PID_PATH" && chown -R "$RUN_AS" "$PID_PATH" > /dev/null || {
log_warning_msg "$DESC: Could not create $PID_FILE, See $SETTINGS, aborting.";
return 1;}
if [ -e "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ! kill -0 "$PID" > /dev/null 2>&1; then
log_warning_msg "Removing stale $PID_FILE"
rm "$PID_FILE"
fi
fi
}
handle_datadir () {
[ -d "$DATA_DIR" ] || mkdir -p "$DATA_DIR" && chown -R "$RUN_AS" "$DATA_DIR" > /dev/null || {
log_warning_msg "$DESC: Could not create $DATA_DIR, See $SETTINGS, aborting.";
return 1;}
}
handle_updates () {
chown -R "$RUN_AS" "$APP_PATH" > /dev/null || {
log_warning_msg "$DESC: $APP_PATH not writable by $RUN_AS for web-updates";
return 0; }
}
start_headphones () {
handle_pid
handle_datadir
handle_updates
if ! is_running; then
log_daemon_msg "Starting $DESC"
start-stop-daemon -o -d $APP_PATH -c $RUN_AS --start $EXTRA_SSD_OPTS --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
check_retval
else
log_success_msg "$DESC: already running (pid $PID)"
fi
}
stop_headphones () {
if is_running; then
log_daemon_msg "Stopping $DESC"
start-stop-daemon -o --stop --pidfile "$PID_FILE" --retry 15
check_retval
else
log_success_msg "$DESC: not running"
fi
}
case "$1" in
start)
start_headphones
;;
stop)
stop_headphones
;;
restart|force-reload)
stop_headphones
start_headphones
;;
status)
status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
Comme pour sickrage, 3 choses à modifier :
# Provides: headphones_xataz
HP_USER=xataz
HP_INSTALL=/opt/headphones