Browse Source

Add v-rebuild-users

Allow the user to rebuild multiple accounts at once.
Kristan Kenney 6 years ago
parent
commit
475b4dab53
1 changed files with 50 additions and 0 deletions
  1. 50 0
      bin/v-rebuild-users

+ 50 - 0
bin/v-rebuild-users

@@ -0,0 +1,50 @@
+#!/bin/bash
+# info: rebuild system user
+# options: USER [RESTART]
+#
+# The function rebuilds system user accounts.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+restart=$1
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/func/rebuild.sh
+source $HESTIA/conf/hestia.conf
+
+# Export sbin
+export PATH=$PATH:/usr/sbin
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '1' "$#" 'USER [RESTART]'
+is_format_valid 'user'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Rebuild loop
+for user in $($BIN/v-list-users plain |cut -f 1); do
+    $BIN/v-rebuild-user $user
+done
+
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+# Logging
+log_event "$OK" "$ARGUMENTS"
+
+exit