Skip to content

Commit 475b4da

Browse files
Kristan Kenneyunknown
authored andcommitted
Add v-rebuild-users
Allow the user to rebuild multiple accounts at once.
1 parent 71d9a44 commit 475b4da

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

bin/v-rebuild-users

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# info: rebuild system user
3+
# options: USER [RESTART]
4+
#
5+
# The function rebuilds system user accounts.
6+
7+
#----------------------------------------------------------#
8+
# Variable&Function #
9+
#----------------------------------------------------------#
10+
11+
# Argument definition
12+
restart=$1
13+
14+
# Includes
15+
source $HESTIA/func/main.sh
16+
source $HESTIA/func/rebuild.sh
17+
source $HESTIA/conf/hestia.conf
18+
19+
# Export sbin
20+
export PATH=$PATH:/usr/sbin
21+
22+
23+
#----------------------------------------------------------#
24+
# Verifications #
25+
#----------------------------------------------------------#
26+
27+
check_args '1' "$#" 'USER [RESTART]'
28+
is_format_valid 'user'
29+
is_object_valid 'user' 'USER' "$user"
30+
is_object_unsuspended 'user' 'USER' "$user"
31+
32+
33+
#----------------------------------------------------------#
34+
# Action #
35+
#----------------------------------------------------------#
36+
37+
# Rebuild loop
38+
for user in $($BIN/v-list-users plain |cut -f 1); do
39+
$BIN/v-rebuild-user $user
40+
done
41+
42+
43+
#----------------------------------------------------------#
44+
# Hestia #
45+
#----------------------------------------------------------#
46+
47+
# Logging
48+
log_event "$OK" "$ARGUMENTS"
49+
50+
exit

0 commit comments

Comments
 (0)