remove pid if stream is not running

This commit is contained in:
lulzette 2021-04-24 09:36:02 +03:00
parent b4b1b6394d
commit 56906d9b16
2 changed files with 4 additions and 4 deletions

View File

@ -15,12 +15,13 @@ source $full_path/config_list.sh
#if pid exists and stream is live, than exit and do not start recording #if pid exists and stream is live, than exit and do not start recording
[ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 $twitchid && exit 0 [ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 $twitchid && exit 0
touch $storage_path/$1/pid
#exit if no stream #exit if no stream
$full_path/lifeChk.py $1 $twitchid || exit 0 $full_path/lifeChk.py $1 $twitchid || rm $storage_path/$1/pid ; exit 0
# echo `$full_path/lifeChk.py $1` # echo `$full_path/lifeChk.py $1`
#set pid and start recording #set pid and start recording
echo $! > $storage_path/$1/pid
/home/losted/.local/bin/youtube-dl -v -o $storage_path/$1/"%(upload_date)s_%(title)s__%(timestamp)s_%(id)s.%(ext)s" twitch.tv/$1 >> $storage_path/$1/youtube-dl.log 2>&1 /home/losted/.local/bin/youtube-dl -v -o $storage_path/$1/"%(upload_date)s_%(title)s__%(timestamp)s_%(id)s.%(ext)s" twitch.tv/$1 >> $storage_path/$1/youtube-dl.log 2>&1
#remove pid #remove pid

View File

@ -19,8 +19,7 @@ done
#Show status #Show status
echo "====" echo "===="
for i in $list; do for i in $list; do
[[ -f $storage_path/$i/pid ]] && echo $i "is recording!" || echo $i "is not recording" [[ -f $storage_path/$i/pid ]] && echo $i "is recording!" || echo $i "is not recording"
done done
echo "====" echo "===="