AlternC/src/alternc_reload

66 lines
2.2 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# $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"
if [ `whoami` = 'root' ]; then
sudo="env"
else
sudo="sudo"
fi
RELOAD_ZONES="$*"
if [ ! -z "$RELOAD_ZONES" ]; then
if [ "$RELOAD_ZONES" = "all" ]; then
$sudo rndc reload > /dev/null || echo "Cannot reload bind" >> "$DOMAIN_LOG_FILE"
else
for zone in $RELOAD_ZONES; do
$sudo rndc reload "$zone" > /dev/null || echo "Cannot reload bind for zone $zone" >> "$DOMAIN_LOG_FILE"
done
fi
if [ -x /usr/sbin/apache ]; then
$sudo invoke-rc.d apache reload > /dev/null || echo "Cannot restart apache" >> "$DOMAIN_LOG_FILE"
fi
if [ -x /usr/sbin/apache2 ]; then
$sudo invoke-rc.d apache2 reload > /dev/null || echo "Cannot restart apache" >> "$DOMAIN_LOG_FILE"
fi
fi