|
| 1 | +#!/bin/bash |
| 2 | +# info: rebuild all assets for a specified user |
| 3 | +# options: USER [RESTART] |
| 4 | +# |
| 5 | +# The function rebuilds all assets for a user account: |
| 6 | +# - Web domains |
| 7 | +# - DNS zones |
| 8 | +# - Mail domains |
| 9 | +# - Databases |
| 10 | +# - Cron Jobs |
| 11 | +# - User account configuration |
| 12 | + |
| 13 | +#----------------------------------------------------------# |
| 14 | +# Variable&Function # |
| 15 | +#----------------------------------------------------------# |
| 16 | + |
| 17 | +# Argument definition |
| 18 | +user=$1 |
| 19 | +restart=$2 |
| 20 | + |
| 21 | +# Includes |
| 22 | +source $HESTIA/func/main.sh |
| 23 | +source $HESTIA/func/rebuild.sh |
| 24 | +source $HESTIA/conf/hestia.conf |
| 25 | + |
| 26 | +# Export sbin |
| 27 | +export PATH=$PATH:/usr/sbin |
| 28 | + |
| 29 | + |
| 30 | +#----------------------------------------------------------# |
| 31 | +# Verifications # |
| 32 | +#----------------------------------------------------------# |
| 33 | + |
| 34 | +check_args '1' "$#" 'USER [RESTART]' |
| 35 | +is_format_valid 'user' |
| 36 | +is_object_valid 'user' 'USER' "$user" |
| 37 | +is_object_unsuspended 'user' 'USER' "$user" |
| 38 | + |
| 39 | + |
| 40 | +#----------------------------------------------------------# |
| 41 | +# Action # |
| 42 | +#----------------------------------------------------------# |
| 43 | + |
| 44 | +# Rebuild loop |
| 45 | +for user in $($HESTIA/bin/v-list-sys-users plain); do |
| 46 | + $BIN/v-rebuild-web-domains $user $restart |
| 47 | + $BIN/v-rebuild-dns-domains $user $restart |
| 48 | + $BIN/v-rebuild-mail-domains $user $restart |
| 49 | + $BIN/v-rebuild-databases $user $restart |
| 50 | + $BIN/v-rebuild-cron-jobs $user $restart |
| 51 | + $BIN/v-rebuild-user $user $restart |
| 52 | +done |
| 53 | + |
| 54 | + |
| 55 | +#----------------------------------------------------------# |
| 56 | +# Hestia # |
| 57 | +#----------------------------------------------------------# |
| 58 | + |
| 59 | +# Logging |
| 60 | +log_event "$OK" "$ARGUMENTS" |
| 61 | + |
| 62 | +exit |
0 commit comments