sr / beadmin

Python scripts hacked together to manage bearnaise.net

Jordan Bracco (author)
Tue Dec 23 12:37:28 -0800 2008
sr (committer)
Tue Dec 23 12:52:28 -0800 2008
beadmin / restart-lighttpd.sh
100755 17 lines (12 sloc) 0.697 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
 
cp /etc/lighttpd/lighttpd-mysql.conf /etc/lighttpd/lighttpd-mysql.conf.bak
python /beadmin/lighttpd-mysql-config.py > /etc/lighttpd/lighttpd-mysql.conf
 
echo `date` Lighttpd restarted by $SUDO_USER >> /var/log/restart-lighttpd.log
 
/etc/init.d/lighttpd reload
 
if [ "$?" != "0" ] ; then
echo "Une erreur à eu lieu lors de l'application de votre configuration."
echo "L'ancienne configuration a été restorée, merci de corriger vos modifications."
cp /etc/lighttpd/lighttpd-mysql.conf.bak /etc/lighttpd/lighttpd-mysql.conf
/etc/init.d/lighttpd reload
echo `date` Lighttpd restart by $SUDO_USER failed. Restarting with old configuration file >> /var/log/restart-lighttpd.log
fi