|
| 1 | +#!/bin/bash |
| 2 | +# info: delete backup exclusion |
| 3 | +# options: USER [SYSTEM] |
| 4 | +# |
| 5 | +# The function for deleteing backup exclusion |
| 6 | + |
| 7 | + |
| 8 | +#----------------------------------------------------------# |
| 9 | +# Variable&Function # |
| 10 | +#----------------------------------------------------------# |
| 11 | + |
| 12 | +# Argument defenition |
| 13 | +user=$1 |
| 14 | +system=$(echo $2 | tr '[:lower:]' '[:upper:]') |
| 15 | + |
| 16 | +# Includes |
| 17 | +source $VESTA/func/main.sh |
| 18 | +source $VESTA/conf/vesta.conf |
| 19 | + |
| 20 | + |
| 21 | +#----------------------------------------------------------# |
| 22 | +# Verifications # |
| 23 | +#----------------------------------------------------------# |
| 24 | + |
| 25 | +check_args '1' "$#" 'USER [SYSTEM]' |
| 26 | +validate_format 'user' |
| 27 | +is_object_valid 'user' 'USER' "$user" |
| 28 | + |
| 29 | + |
| 30 | +#----------------------------------------------------------# |
| 31 | +# Action # |
| 32 | +#----------------------------------------------------------# |
| 33 | + |
| 34 | +# Delete system exclusion |
| 35 | +if [ -z "$system" ]; then |
| 36 | + WEB='' |
| 37 | + DNS='' |
| 38 | + MAIL='' |
| 39 | + DB='' |
| 40 | + CRON='' |
| 41 | + USER='' |
| 42 | +else |
| 43 | + touch $USER_DATA/backup-excludes.conf |
| 44 | + source $USER_DATA/backup-excludes.conf |
| 45 | + case $system in |
| 46 | + WEB) WEB='';; |
| 47 | + DNS) DNS='';; |
| 48 | + MAIL) MAIL='';; |
| 49 | + DB) DB='';; |
| 50 | + CRON) CRON='';; |
| 51 | + USER) USER='';; |
| 52 | + esac |
| 53 | +fi |
| 54 | + |
| 55 | +# Updating exlusion list |
| 56 | +echo "WEB='$WEB'" > $USER_DATA/backup-excludes.conf |
| 57 | +echo "DNS='$DNS'" >> $USER_DATA/backup-excludes.conf |
| 58 | +echo "MAIL='$MAIL'" >> $USER_DATA/backup-excludes.conf |
| 59 | +echo "DB='$DB'" >> $USER_DATA/backup-excludes.conf |
| 60 | +echo "CRON='$DB'" >> $USER_DATA/backup-excludes.conf |
| 61 | +echo "USER='$USER'" >> $USER_DATA/backup-excludes.conf |
| 62 | +chmod 660 $USER_DATA/backup-excludes.conf |
| 63 | + |
| 64 | + |
| 65 | +#----------------------------------------------------------# |
| 66 | +# Vesta # |
| 67 | +#----------------------------------------------------------# |
| 68 | + |
| 69 | +# Logging |
| 70 | +if [ -z "$system" ]; then |
| 71 | + log_history "deleted all exlusions" |
| 72 | +else |
| 73 | + log_history "deleted $system exlusion" |
| 74 | +fi |
| 75 | +log_event "$OK" "$EVENT" |
| 76 | + |
| 77 | +exit |
0 commit comments