initial re-commit to wipe commit histoy due to public repo
This commit is contained in:
24
other/haphazard_reboot.sh
Executable file
24
other/haphazard_reboot.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Random Reboot after minimum uptime script
|
||||
# Flat 1 in $CHANCE chance of reboot -- crontab freq matters.
|
||||
# Expected per hour run
|
||||
# 1000000 is one day
|
||||
# chance 192 is average 8 day
|
||||
|
||||
MIN_UT=4000000
|
||||
CHANCE=192
|
||||
|
||||
UPTIMEVAL=$(uptime | cut -f 2 -d ' ' | sed "s/://g")
|
||||
echo "Flat uptime:$UPTIMEVAL"
|
||||
|
||||
#UPTIMEVAL=220000
|
||||
|
||||
if [[ $UPTIMEVAL -gt $MIN_UT ]] ; then
|
||||
echo "gt success, now random"
|
||||
if [[ $(( $RANDOM % 48 )) == 0 ]] ; then
|
||||
echo "random success"
|
||||
reboot
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user