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
|
# $username and $password are retrieved from create-account script
|
||||||
if [[ -z $1 || -z $2 ]]
|
if [[ -z $1 || -z $2 ]]
|
||||||
then
|
then
|
||||||
echo -e "Usage: $(basename $0) [username] [password] "
|
echo -e "Usage: $(basename $0) [username] [password]"
|
||||||
exit
|
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
|
username=$1
|
||||||
password=$2
|
password=$2
|
||||||
|
|
||||||
|
@ -29,5 +37,7 @@ EOF
|
||||||
echo " </Pass>" >> $CONF
|
echo " </Pass>" >> $CONF
|
||||||
echo "</User>" >> $CONF
|
echo "</User>" >> $CONF
|
||||||
|
|
||||||
|
sleep 1
|
||||||
kill -s HUP $PID # Reload znc.conf
|
kill -s HUP $PID # Reload znc.conf
|
||||||
|
sleep 1
|
||||||
kill -s USR1 $PID # Rewrite znc.conf
|
kill -s USR1 $PID # Rewrite znc.conf
|
||||||
|
|
Loading…
Reference in New Issue