packages/net/oscam/files/oscam-watchdog.sh
2024-11-16 15:13:37 +08:00

32 lines
565 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
sleeptime=60
logfile="/var/log/oscam.log"
OSCAM_PATH=/usr/bin
enable=$(uci get oscam.config.enabled 2>/dev/null)
oscam_log(){
logrow=$(grep -c "" ${logfile})
if [ $logrow -ge 500 ];then
cat /dev/null > ${logfile}
echo "$curtime Log条数超限清空处理" >> ${logfile}
fi
}
while [ $enable -eq 1 ];
do
oscam_log
curtime=`date "+%H:%M:%S"`
echo "$curtime online! "
if ! pidof oscam>/dev/null; then
service_start ${OSCAM_PATH}/oscam -b -r 2 -u
echo "$curtime 重启服务!" >> ${logfile}
fi
sleep ${sleeptime}
continue
done