mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Adding function wait_for_backup_if_it_is_not_time_for_backup()
This commit is contained in:
parent
be684a7f90
commit
525bd0f162
1 changed files with 21 additions and 0 deletions
21
func/main.sh
21
func/main.sh
|
@ -938,3 +938,24 @@ format_aliases() {
|
|||
aliases=$(echo "$aliases" |tr '\n' ',' |sed -e "s/,$//")
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
wait_for_backup_if_it_is_not_time_for_backup() {
|
||||
# block backup if current hour is after 6 AM
|
||||
WAIT_LOOP_ENTERED=0
|
||||
if pgrep -x "v-backup-users" > /dev/null
|
||||
then
|
||||
hour=$(date +"%H");
|
||||
while [ "$hour" -gt "6" ]; do
|
||||
if [ "$WAIT_LOOP_ENTERED" -eq 0 ]; then
|
||||
# do something when enter sleeping state
|
||||
# $BIN/v-restart-web-backend
|
||||
fi
|
||||
WAIT_LOOP_ENTERED=1
|
||||
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
|
||||
echo "$current_date_time - wait to backup user $user - current hour is $hour";
|
||||
sleep 300
|
||||
hour=$(date +"%H");
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue