AlternC/src/alternc_reload

84 lines
2.4 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# $Id: update_domaines.sh,v 1.31 2005/08/29 19:21:31 anarcat Exp $
# ----------------------------------------------------------------------
# AlternC - Web Hosting System
# Copyright (C) 2002 by the AlternC Development Team.
# http://alternc.org/
# ----------------------------------------------------------------------
# Based on:
# Valentin Lacambre's web hosting softwares: http://altern.org/
# ----------------------------------------------------------------------
# LICENSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
# ----------------------------------------------------------------------
# Original Author of file: Jerome Moinet for l'Autre Net - 14/12/2000
# Purpose of file: service reloading
# ----------------------------------------------------------------------
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
set -e
umask 022
########################################################################
# Constants & Preliminary checks
#
DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log"
exec >>"$DOMAIN_LOG_FILE" 2>&1
if [ `whoami` = 'root' ]; then
2011-03-27 14:59:21 +00:00
sudo=""
else
2011-03-07 10:09:20 +00:00
sudo="sudo"
fi
2011-03-11 17:33:40 +00:00
apache_reload() {
2011-03-07 10:09:20 +00:00
if [ -x /usr/sbin/apache2ctl ]; then
$sudo /usr/sbin/apache2ctl graceful || echo "Cannot restart apache"
2011-03-07 10:09:20 +00:00
fi
}
dns_restart() {
if [ -x /etc/init.d/bind9 ]; then
$sudo /etc/init.d/bind9 restart || echo "Cannot restart dns daemon (bind9)"
fi
}
RELOAD_ZONES="$*"
echo $RELOAD_ZONES
if [ ! -z "$RELOAD_ZONES" ]; then
2011-03-07 10:09:20 +00:00
for zone in $RELOAD_ZONES; do
case $zone in
"all")
$sudo rndc reload || echo "Cannot reload bind"
2011-03-07 10:09:20 +00:00
apache_reload # keep for compatibility
;;
"apache")
apache_reload
;;
*)
# FIXME: should reload only concerned zones
2012-08-26 11:02:46 +00:00
#$sudo rndc reload "$zone" || echo "Cannot reload bind for zone $zone"
$sudo rndc reload || echo "Cannot reload bind for zone $zone"
2011-03-07 10:09:20 +00:00
;;
esac
done
fi
2011-03-07 10:09:20 +00:00