我有一个rtorrent的bash post进程脚本。 在其中我尝试创建一个Container,启动它,最后删除它。 所有通过curl命令到我安装到容器中的docker socket。 该命令已从rtorrent成功执行。 pushover的curl命令运行良好。
但是我得到一个卷曲:(7)无法连接到服务器错误消息的docker curl命令。
希望有人能指出我正确的方向。
日志:
^@
---
^@/usr/local/bin/rtorrent-postprocess.sh /Pathtothedownload Nameofthedownload label
---
^@{"status":1,"request":"ec5c3c9c-5744-48f4-909b-68d38ec5e659"}curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
--- Success ---
脚本:
#!/bin/bash
# rtorrent postprocess Script by Tobias
export LANG=de_DE.UTF-8
# The file for logging events from this script
LOGFILE="/config/rtorrent-postprocess.log"
#LOGFILE="./debug.log"
# Pfad des Downloads
FOLDER="$1"
# Name des Downloads
NAME="$2"
# Label des Downloads
LABEL="$3"
# Media Verzeichniss /data/Media
MEDIA="/data/Media"
# COMPLETE Verzeichniss mit label /data/torrent/completed/$3
COMPLETE="/data/torrent/completed/$3"
##############################################################################
function edate
{
echo "`date '+%Y-%m-%d %H:%M:%S'` $1" >> "$LOGFILE"
}
function pushover {
curl -s \
-F "token=xxxxxxxxxxxxxxxx" \
-F "user=xxxxxxxxxxxxxxxxx" \
-F "message=$1 finished $2 $3 on `date +%d.%m.%y-%H:%m`" \
https://api.pushover.net/1/messages.json
}
edate " "
edate "Verzeichniss ist $COMPLETE"
edate "Name ist $NAME"
edate "Label ist $LABEL"
edate "rtorrent finished downloading $NAME"
pushover "rtorrent" "downloading" "$NAME"
edate "Starte Filebot - $COMPLETE/$NAME"
test_command() {
curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/wait" -H "accept: application/json"
}
curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{ "Image": "rednoah/filebot", "Cmd": ["-script", "fn:amc", "--output", "/Media", "--action", "move", "-non-strict", "/volume1", "--log-file", "/opt/rtorrentvpn/config/filebot.log", "--conflict", "auto", "--def", "artwork=n", "seriesFormat=Serien/{localize.eng.n}/Season {s.pad(2)}/{localize.eng.n} - {s00e00} - {localize.deu.t}", "movieFormat=Filme/{localize.deu.n} ({y})/{localize.deu.n} ({y})", "musicFormat=Musik/{artist}/{album}/{fn}"], "HostConfig": { "Binds": ["'$COMPLETE/$NAME':/volume1", "data:/data", "/data/Media:/Media"]} }' "http://localhost/containers/create?name=${NAME}"
curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/start" -H "accept: application/json"
if [ "$(test_command)" == "200" ]; then
edate "Status ist $test_command"
fi
curl --unix-socket /var/run/docker.sock -X DELETE "http://localhost/containers/${NAME}?force=true?v=true" -H "accept: application/json"
edate " "
edate "Filebot fertig"