From 7901a7c8b8201c5eece433163c7bb03dd3ff46f4 Mon Sep 17 00:00:00 2001 From: MarkusMcNugen Date: Sun, 4 Feb 2018 21:09:35 -0500 Subject: [PATCH] Update qbittorrent.init --- qbittorrent/qbittorrent.init | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qbittorrent/qbittorrent.init b/qbittorrent/qbittorrent.init index 5c12a91..617d45e 100644 --- a/qbittorrent/qbittorrent.init +++ b/qbittorrent/qbittorrent.init @@ -22,7 +22,8 @@ SCRIPTNAME="/etc/init.d/qbittorrent" NAME="qbittorrent-nox" DESC="qBittorrent" PIDFILE="/var/run/$NAME.pid" -QBTLOG="/config/qBittorrent/data/logs/qbittorrent-daemon.log" +QBTLOGPATH="/config/qBittorrent/data/logs/" +QBTLOG="qbittorrent-daemon.log" DAEMON="/usr/bin/qbittorrent-nox" DAEMON_ARGS="--profile=/config" @@ -46,19 +47,25 @@ export DBUS_SESSION_BUS_ADDRESS="" do_start() { + #Check if log path exists. If it doesn't exist, create it. + if [ ! -e $QBTLOGPATH ]; then + mkdir -p $QBTLOGPATH + chown -R ${PUID}:${PGID} /config/qBittorrent + fi + #Check for log file. If it doesn't exist, create it. - if [ -f $QBTLOG ]; + if [ -f $QBTLOGPATH$QBTLOG ]; then - echo "Logging to $QBTLOG." + echo "Logging to $QBTLOGPATH$QBTLOG." else - echo "Log file $QBTLOG doesn't exist. Creating it..." + echo "Log file $QBTLOGPATH$QBTLOG doesn't exist. Creating it..." touch $QBTLOG - chown $USER:$GROUP $QBTLOG + chown $USER:$GROUP $QBTLOGPATH$QBTLOG if [ -f $QBTLOG ]; then - echo "Logfile created. Logging to $QBTLOG" + echo "Logfile created. Logging to $QBTLOGPATH$QBTLOG" else - echo "Couldn't create logfile $QBTLOG. Please investigate." + echo "Couldn't create logfile $QBTLOGPATH$QBTLOG. Please investigate." fi fi