twitch-autosave/cron.sh

29 lines
801 B
Bash
Raw Normal View History

2019-11-09 01:29:29 +03:00
#!/bin/bash
##########
# (actually main) script which cron (systemd.timer) starts by time
##########
full_path=$(dirname "$(realpath $0)")
2020-03-21 09:39:30 +03:00
source $full_path/config_list.sh
2019-11-09 01:29:29 +03:00
for i in $list; do
echo "$i is live?..."
#check folder
[ ! -d $storage_path/$i ] && mkdir -p $storage_path/$i && echo "Created dir $storage_path/$i"
2019-11-09 01:29:29 +03:00
#detached check & start
2021-04-21 22:03:55 +03:00
nohup bash $full_path/check.sh $i &>> $storage_path/$1/youtube-dl.log &
sleep 2
2019-11-09 01:29:29 +03:00
done
#Show status
2021-04-24 10:24:47 +03:00
echo
2019-11-09 01:29:29 +03:00
for i in $list; do
2021-04-24 09:36:02 +03:00
[[ -f $storage_path/$i/pid ]] && echo $i "is recording!" || echo $i "is not recording"
2019-11-09 01:29:29 +03:00
done
2021-04-24 10:24:47 +03:00
echo
2021-04-24 10:20:55 +03:00
echo "Removing old files (older than $ctime_remove days):"
2021-04-24 10:19:38 +03:00
find $storage_path/ -ctime +$ctime_remove -name "*mp4*"
find $storage_path/ -ctime +$ctime_remove -name "*mp4*" -exec rm {} \;
echo "Done"