source: alternc/trunk/src/alternc_reload @ 2867

Revision 2867, 2.2 KB checked in by fufroma, 4 years ago (diff)

Reload allégé

  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# $Id: update_domaines.sh,v 1.31 2005/08/29 19:21:31 anarcat Exp $
4# ----------------------------------------------------------------------
5# AlternC - Web Hosting System
6# Copyright (C) 2002 by the AlternC Development Team.
7# http://alternc.org/
8# ----------------------------------------------------------------------
9# Based on:
10# Valentin Lacambre's web hosting softwares: http://altern.org/
11# ----------------------------------------------------------------------
12# LICENSE
13#
14# This program is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License (GPL)
16# as published by the Free Software Foundation; either version 2
17# of the License, or (at your option) any later version.
18#
19# This program is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22# GNU General Public License for more details.
23#
24# To read the license please visit http://www.gnu.org/copyleft/gpl.html
25# ----------------------------------------------------------------------
26# Original Author of file: Jerome Moinet for l'Autre Net - 14/12/2000
27# Purpose of file: service reloading
28# ----------------------------------------------------------------------
29#
30
31PATH=/sbin:/bin:/usr/sbin:/usr/bin
32
33set -e
34
35umask 022
36
37########################################################################
38# Constants & Preliminary checks
39#
40
41DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log"
42
43if [ `whoami` = 'root' ]; then
44  sudo="env"
45else
46  sudo="sudo"
47fi
48
49function apache_reload() {
50  if [ -x /usr/sbin/apache2ctl ]; then
51    $sudo /usr/sbin/apache2ctl graceful > /dev/null || echo "Cannot restart apache" >> "$DOMAIN_LOG_FILE"
52  fi
53}
54
55RELOAD_ZONES="$*"
56
57if [ ! -z "$RELOAD_ZONES" ]; then
58  for zone in $RELOAD_ZONES; do
59    case $zone in
60      "all")
61        $sudo rndc reload > /dev/null || echo "Cannot reload bind" >> "$DOMAIN_LOG_FILE"
62        apache_reload # keep for compatibility
63        ;;
64      "apache")
65        apache_reload
66        ;;
67      *)
68        $sudo rndc reload "$zone" > /dev/null || echo "Cannot reload bind for zone $zone" >> "$DOMAIN_LOG_FILE"
69        ;;
70    esac
71  done
72fi
73
Note: See TracBrowser for help on using the repository browser.