Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #(...)
- echo -e "$INFO Launching $botname ..."
- while true ; do
- #CHECK LOGs
- date=$(date +"%Y-%m-%d_at_%Hh-%Mm-%Ss")
- logfile="logs/${botname}_${date}.log"
- (
- echo -e "#####################################"
- echo -e "$INFO It's $(date +"%Y-%m-%d @ %Hh:%Mm:%Ss")"
- echo -e "$INFO STARTING $botname LOG FILE"
- pkill -x $botname
- ) | tee -a $logfile
- #RANDOM KILL TIME
- if [[ "$botname" == "alfa"* ]]; then
- randt=$(shuf -i "$kill_af"-"$ekill_af" -n 1)
- else
- randt=$(shuf -i "$kill_tf"-"$ekill_tf" -n 1)
- fi
- ## FROM HERE ##################
- (
- echo -e "$INFO KILLING IN $randt minutes"
- sleep "$randt"m
- pkill -x $botname && \
- echo -e "$OK CORRECTLY KILLED $(date +"%Y-%m-%d @ %Hh:%Mm:%Ss")"
- ) & #| tee -a $logfile
- STARTTIME=$(date +%m)
- echo -e "$INFO EXECUTING "${BYELLOW} $botname ${NC}"..."
- ./$botname >> $logfile
- ENDTIME=$(date +%m)
- ELAPSEDTIME=$(($ENDTIME-$STARTTIME))
- if [[ "$ELAPSEDTIME" -le 5 ]]; then
- echo -e "$WARNING Elapsed time is ("$ELAPSEDTIME") lower or equal to 5 minutes.\nSomething failed with ./$botname" | tee -a $logfile
- randt=$(shuf -i 65-125 -n 1) #1-2h
- else
- #RANDOM REST TIME
- if [[ "$botname" == "alfa"* ]] ; then
- randt=$(shuf -i "$sleep_af"-"$esleep_af" -n 1)
- else
- randt=$(shuf -i "$sleep_tf"-"$esleep_tf" -n 1)
- fi
- fi
- echo -e "$INFO REST-SLEEP OF $randt minutes till next session. " | tee -a $logfile
- sleep "$randt"m
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement