Don't need the rm -f statement when using > redirect to overwrite the

file, and add the "then" to the if statements
This commit is contained in:
gnhb 2010-03-28 22:04:13 +07:00
parent 158b5cc3fb
commit 5ca41f8b4f

View File

@ -1,7 +1,5 @@
#!/bin/sh
/bin/rm -f /var/etc/nameserver_$1
# unset CGI environment variables so as not to confuse PHP
unset CONTENT_TYPE GATEWAY_INTERFACE REMOTE_USER REMOTE_ADDR AUTH_TYPE
unset HTTP_USER_AGENT CONTENT_LENGTH SCRIPT_FILENAME HTTP_HOST
@ -9,12 +7,12 @@ unset SERVER_SOFTWARE HTTP_REFERER SERVER_PROTOCOL REQUEST_METHOD
unset SERVER_PORT SCRIPT_NAME SERVER_NAME
# write nameservers to file
if [ "$6" = "dns1" ]
if [ $6 = "dns1" ]; then
echo $7 > /var/etc/nameserver_$1
/sbin/route add $7 $4
fi
if [ "$8" = "dns2" ]
if [ $8 = "dns2" ]; then
echo $9 >> /var/etc/nameserver_$1
/sbin/route add $9 $4
fi