File: //opt/BCLinux/bse/option_check/c25_addUser
#!/bin/sh
#=====================================================================
InsertSection "Check whether have the customer user"
############### default value #################
# UserName=wangguan #
# UserPass=xxxxxxxx #
############### default value #################
if [[ ! -z $UserName ]];then
for i in `cat /etc/passwd |awk -F ':' '{print $3 ":" $1}' | sort -n -r | cut -d ':' -f 2`
do
if [[ ${UserName} = $i ]];then
count_user=`expr ${count_user} + 1`
fi
done
if [[ $count_user -gt 0 ]];then
logtext "already have ${UserName}, no need to add"
Display --indent 2 --text "- Already have user:${UserName}..." --result OK --color GREEN
AddHP 1 1
else
echo "c25" >> $RESULT_FILE
echo "" >> $RESULT_FILE
logtext "WRN_C25: $(loadtext TXT_WRN_C25)"
logtext "Suggestion: $(loadtext TXT_SUG_C25)"
Display --indent 2 --text "- Check whether have additional user... " --result WARNING --color RED
Display --indent 2 --text "No additional user found, check warning"
AddHP 0 1
fi
else
logtext "No valid userName found, please check config file..."
Display --indent 2 --text "- No valid userName found, please check config file..." --result FAILED --color RED
fi