update
This commit is contained in:
21
defaults.inc
21
defaults.inc
@@ -49,4 +49,23 @@ MMUPDATECHECK(){
|
|||||||
|
|
||||||
SENDNOTICE(){
|
SENDNOTICE(){
|
||||||
[ "${EMAIL_NOTICE}" != "" ] && echo -e "${2}\n\n$(date)" | mail -s "${1}" ${EMAIL_NOTICE}
|
[ "${EMAIL_NOTICE}" != "" ] && echo -e "${2}\n\n$(date)" | mail -s "${1}" ${EMAIL_NOTICE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uptime_minutes() {
|
||||||
|
set `uptime -p`
|
||||||
|
local minutes=0
|
||||||
|
shift
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case $2 in
|
||||||
|
day*)
|
||||||
|
((minutes+=$1*1440));;
|
||||||
|
hour*)
|
||||||
|
((minutes+=$1*60));;
|
||||||
|
minute*)
|
||||||
|
((minutes+=$1));;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
echo $minutes
|
||||||
|
}
|
||||||
|
|||||||
11
run.sh
11
run.sh
@@ -71,15 +71,10 @@ else
|
|||||||
rm -f ${MMFOLDER}/mm.*
|
rm -f ${MMFOLDER}/mm.*
|
||||||
fi
|
fi
|
||||||
if [ -f ${MMFOLDER}/mm.stop.checking ] && [ "${1}" != "status" ]; then
|
if [ -f ${MMFOLDER}/mm.stop.checking ] && [ "${1}" != "status" ]; then
|
||||||
fd=$(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.stop.checking))
|
#fd=$(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.stop.checking))
|
||||||
|
if [ $(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.stop.checking)) -gt 900 ]; then
|
||||||
# if [ -f ${MMFOLDER}/mm.stop.checking ]; then
|
|
||||||
# rm -f ${MMFOLDER}/mm.stop*
|
|
||||||
# fi
|
|
||||||
|
|
||||||
if [ ${fd} -gt 900 ]; then
|
|
||||||
rm -f ${MMFOLDER}/mm.stop*
|
rm -f ${MMFOLDER}/mm.stop*
|
||||||
elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ ! -f ${MMFOLDER}/mm.vpn* ]; then
|
elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ ! -f ${MMFOLDER}/mm.vpn* ] && [ $(uptime_minutes) -lt 2 ]; then
|
||||||
rm -f ${MMFOLDER}/mm.stop*
|
rm -f ${MMFOLDER}/mm.stop*
|
||||||
else
|
else
|
||||||
echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user