Skip to content

Instantly share code, notes, and snippets.

@allanlaal
Created March 11, 2014 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanlaal/9491526 to your computer and use it in GitHub Desktop.
Save allanlaal/9491526 to your computer and use it in GitHub Desktop.
#!/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