Script toegevoegd
This commit is contained in:
50
rebootSchedule.sh
Normal file
50
rebootSchedule.sh
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Zie ook https://wiki.de-roo.org/doku.php/cron
|
||||||
|
|
||||||
|
FIRST=("fs01")
|
||||||
|
SECOND=("web06" "web03" "mail02")
|
||||||
|
THIRD=("net02" "net03" "net04" "net05")
|
||||||
|
REST=("git01" "run01")
|
||||||
|
|
||||||
|
for SERVER in ${FIRST[@]}; do
|
||||||
|
echo Starting reboot of $SERVER
|
||||||
|
ssh $SERVER reboot now
|
||||||
|
done
|
||||||
|
|
||||||
|
# 1:15h
|
||||||
|
timeNow=$(date +%s)
|
||||||
|
targetTime=$(date -d 01:15 +%s)
|
||||||
|
timeToWait=$(($targetTime - $timeNow))
|
||||||
|
echo Waiting $timeToWait seconds
|
||||||
|
sleep $timeToWait
|
||||||
|
|
||||||
|
for SERVER in ${SECOND[@]}; do
|
||||||
|
echo Starting reboot of $SERVER
|
||||||
|
ssh $SERVER reboot now
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
|
||||||
|
# 1:30h
|
||||||
|
timeNow=$(date +%s)
|
||||||
|
targetTime=$(date -d 01:30 +%s)
|
||||||
|
timeToWait=$(($targetTime - $timeNow))
|
||||||
|
echo Waiting $timeToWait seconds
|
||||||
|
sleep $timeToWait
|
||||||
|
|
||||||
|
for SERVER in ${THIRD[@]}; do
|
||||||
|
echo Starting reboot of $SERVER
|
||||||
|
ssh $SERVER reboot now
|
||||||
|
done
|
||||||
|
|
||||||
|
# 1:45h
|
||||||
|
timeNow=$(date +%s)
|
||||||
|
targetTime=$(date -d 01:45 +%s)
|
||||||
|
timeToWait=$(($targetTime - $timeNow))
|
||||||
|
echo Waiting $timeToWait seconds
|
||||||
|
sleep $timeToWait
|
||||||
|
|
||||||
|
for SERVER in ${REST[@]}; do
|
||||||
|
echo Starting reboot of $SERVER
|
||||||
|
ssh $SERVER reboot now
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user