search if user has been added previously
This commit is contained in:
parent
260bee58db
commit
4d345cf484
|
@ -7,9 +7,17 @@ PID=$(pgrep -u znc znc)
|
|||
# $username and $password are retrieved from create-account script
|
||||
if [[ -z $1 || -z $2 ]]
|
||||
then
|
||||
echo -e "Usage: $(basename $0) [username] [password] "
|
||||
echo -e "Usage: $(basename $0) [username] [password]"
|
||||
exit
|
||||
if
|
||||
fi
|
||||
|
||||
# search if $username has been added previously
|
||||
if grep -iq $1 $CONF
|
||||
then
|
||||
echo -e "User: '$1' already exists"
|
||||
exit
|
||||
fi
|
||||
|
||||
username=$1
|
||||
password=$2
|
||||
|
||||
|
@ -29,5 +37,7 @@ EOF
|
|||
echo " </Pass>" >> $CONF
|
||||
echo "</User>" >> $CONF
|
||||
|
||||
sleep 1
|
||||
kill -s HUP $PID # Reload znc.conf
|
||||
sleep 1
|
||||
kill -s USR1 $PID # Rewrite znc.conf
|
||||
|
|
Loading…
Reference in New Issue