設定ファイルを差し替えてサービス再起動
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#!/bin/sh
# ----------------------------
# switch script
# ----------------------------
# Version : 1.0
# date : 2008/04/04
export LANG=C
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
# Set
BASEDIR="/usr/local/apache"
BINDIR="/etc/init.d"
CONFDIR=$BASEDIR"/conf"
CONF="httpd.conf"
INIT="apachectl"
ONCONF="httpd.conf.on"
OFFCONF="httpd.conf.off"
# Exec
cd $CONFDIR
case "$1" in
on)
if [ -f $CONFDIR/$ONCONF ]; then
echo -n "Apache DMZ Address Listen ON: "
$BINDIR/$INIT stop
sleep 3
rm -f $CONFDIR/$CONF ; ln -s $ONCONF $CONF
echo
$BINDIR/$INIT start
echo
else
echo "ERR: "$CONFDIR/$ONCONF" not found"
exit 1
fi
;;
off)
if [ -f $CONFDIR/$OFFCONF ]; then
echo -n "Apache DMZ Address Listen OFF: "
$BINDIR/$INIT stop
sleep 3
rm -f $CONFDIR/$CONF ; ln -s $OFFCONF $CONF
echo
$BINDIR/$INIT start
echo
else
echo "ERR: "$CONFDIR/$OFFCONF" not found"
exit 1
fi
;;
*)
echo "Usage: $0 {on|off}"
exit 1
esac
exit 0
# EOF
終了行:
#!/bin/sh
# ----------------------------
# switch script
# ----------------------------
# Version : 1.0
# date : 2008/04/04
export LANG=C
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
# Set
BASEDIR="/usr/local/apache"
BINDIR="/etc/init.d"
CONFDIR=$BASEDIR"/conf"
CONF="httpd.conf"
INIT="apachectl"
ONCONF="httpd.conf.on"
OFFCONF="httpd.conf.off"
# Exec
cd $CONFDIR
case "$1" in
on)
if [ -f $CONFDIR/$ONCONF ]; then
echo -n "Apache DMZ Address Listen ON: "
$BINDIR/$INIT stop
sleep 3
rm -f $CONFDIR/$CONF ; ln -s $ONCONF $CONF
echo
$BINDIR/$INIT start
echo
else
echo "ERR: "$CONFDIR/$ONCONF" not found"
exit 1
fi
;;
off)
if [ -f $CONFDIR/$OFFCONF ]; then
echo -n "Apache DMZ Address Listen OFF: "
$BINDIR/$INIT stop
sleep 3
rm -f $CONFDIR/$CONF ; ln -s $OFFCONF $CONF
echo
$BINDIR/$INIT start
echo
else
echo "ERR: "$CONFDIR/$OFFCONF" not found"
exit 1
fi
;;
*)
echo "Usage: $0 {on|off}"
exit 1
esac
exit 0
# EOF
ページ名: