Created
March 11, 2014 18:06
-
-
Save allanlaal/9491526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
WORKDIR=/root/subdomain_bugfix_daemon/ | |
# I recommend using a dedicated MySQL user with only SELECT rights if you are paranoid: | |
user="root" | |
pass="YOUR MYSQL PASSWORD HERE" | |
db="zpanel_core" | |
(mysql -u "$user" -p"$pass" "$db" <<EOF | |
SELECT COUNT(*) AS total FROM x_vhosts | |
EOF | |
) > $WORKDIR/vhostdb.log | |
sed -i '/total/d' $WORKDIR/vhostdb.log | |
sleep 2 | |
if diff currentcount.log $WORKDIR/vhostdb.log >/dev/null ; then | |
echo Same > /dev/null | |
else | |
/usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1 | |
sleep 2 | |
service apache2 reload | |
sleep 1 | |
cat $WORKDIR/vhostdb.log > currentcount.log | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment