source: misc/scripts/reload_apache.sh @ 753

Last change on this file since 753 was 745, checked in by duh, 12 years ago

added documentation

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Rev
File size: 1.0 KB
Line 
1#!/bin/sh
2# This script allows reloading of apache configuration by other
3# users without granting them sudo access to apachectl. Also,
4# the latter is not possible because of the modular nature of
5# apache on this machine. This script check if a particular
6# file is present. Built for nxb-es...
7#
8# Use a cronjob as root:
9# * * * * * /root/script/reload_apache /home/tomcat/reload_apache 2>&1
10#
11# @Author       Jeroen Wesbeek <J****n.W******@gmail.com>
12# @Since        20100729
13#
14# Revision Information:
15# $Author: duh $
16# $Date: 2010-07-29 09:09:56 +0000 (do, 29 jul 2010) $
17# $Rev: 745 $
18
19STAMP=`date +'%Y%m%d%H%M'`
20
21# check if we are root
22if [ `whoami` != "root" ]
23then
24        echo $STAMP This script needs to be run as root
25        exit;
26fi
27
28# check if we got an argument
29if [ ! $1 ]
30then
31        echo $STAMP Usage: $0 /path/to/file/to/check
32        exit;
33fi
34
35# check if file exists
36if [ ! -f $1 ]
37then
38        # file not found, nothing to do
39        #echo $STAMP .no need to reload apache
40        exit;
41else
42        # restarting apache
43        echo $STAMP .reloading apache...
44fi
45
46# gracefully restart apache
47/usr/sbin/apache2ctl -k graceful
48
49# and remove the original file
50rm $1
Note: See TracBrowser for help on using the repository browser.