diff --git a/create-znc_account.sh b/create-znc_account.sh index ee2fb35..e1e93a7 100644 --- a/create-znc_account.sh +++ b/create-znc_account.sh @@ -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 " " >> $CONF echo "" >> $CONF +sleep 1 kill -s HUP $PID # Reload znc.conf +sleep 1 kill -s USR1 $PID # Rewrite znc.conf