Skip to content

Commit f220906

Browse files
committed
fname/lname change script
1 parent 1f9b5b2 commit f220906

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

bin/v_change_sys_user_name

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# info: changing user nameservers
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Argument defenition
9+
user="$1"
10+
fname="$2"
11+
lname="$3"
12+
13+
# Importing variables
14+
source $VESTA/conf/vars.conf
15+
source $V_FUNC/shared_func.sh
16+
17+
18+
#----------------------------------------------------------#
19+
# Verifications #
20+
#----------------------------------------------------------#
21+
22+
# Checking args
23+
check_args '3' "$#" 'user fname lname'
24+
25+
# Checking argument format
26+
format_validation 'user' 'fname' 'lname'
27+
28+
# Checking user
29+
is_user_valid
30+
31+
# Checking user is active
32+
is_user_suspended
33+
34+
35+
#----------------------------------------------------------#
36+
# Action #
37+
#----------------------------------------------------------#
38+
39+
# Get old values
40+
old_fname=$(get_user_value '$FNAME')
41+
old_lname=$(get_user_value '$LNAME')
42+
43+
# Changing ns values
44+
update_user_value "$user" '$FNAME' "$fname"
45+
update_user_value "$user" '$LNAME' "$lname"
46+
47+
48+
#----------------------------------------------------------#
49+
# Vesta #
50+
#----------------------------------------------------------#
51+
52+
# Logging
53+
log_history "$V_EVENT" "$V_SCRIPT $user $old_fname $old_lname"
54+
log_event 'system' "$V_EVENT"
55+
56+
exit $OK

0 commit comments

Comments
 (0)