| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/bin/bash
- # info: backup all users
- # options: NONE
- #
- # The function backups all system users.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Importing system environment as we run this script
- # mostly by cron which not read it by itself
- source /etc/profile
- # Includes
- source $HESTIA/func/main.sh
- source $HESTIA/conf/hestia.conf
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Auto-repair all databases before backuping all accounts
- mysqlrepair --all-databases --check --auto-repair > /dev/null 2>&1
- if [ -z "$BACKUP_SYSTEM" ]; then
- exit
- fi
- for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
- check_suspend=$(grep "SUSPENDED='no'" $HESTIA/data/users/$user/user.conf)
- log=$HESTIA/log/backup.log
- if [ ! -f "$HESTIA/data/users/$user/user.conf" ]; then
- continue;
- fi
- wait_for_backup_if_it_is_not_time_for_backup
- check_suspend=$(grep "SUSPENDED='no'" $HESTIA/data/users/$user/user.conf)
- log=$HESTIA/log/backup.log
- if [ ! -z "$check_suspend" ]; then
- echo -e "================================" >> $log
- echo -e "$user" >> $log
- echo -e "--------------------------------\n" >> $log
- $BIN/v-backup-user $user >> $log 2>&1
- echo -e "\n--------------------------------\n\n" >> $log
- fi
- done
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- # No Logging
- #log_event "$OK" "$ARGUMENTS"
- exit
|