#!/bin/sh # Start/Stop script for sslproxy # # chkconfig: - 99 01 # description: Start and stop sslproxy # # processname: sslproxy # # Author: Shinya TAKEBAYASHI # Released: September 2009 # Licence: GNU General Public Licence PROG="sslproxy" DAEMON="/usr/sbin/sslproxyadm" LOCKFILE="/var/lock/subsys/sslproxy" start() { if [ -e $LOCKFILE ]; then echo "$PROG is running" return fi echo -n "Starting $PROG: " $DAEMON start RETVAL=$? if [ $RETVAL -ne 0 ]; then echo "error occured" echo "$PROG was not started" else echo "done" touch $LOCKFILE fi return $RETVAL } stop() { echo -n "Stopping $PROG: " $DAEMON stop RETVAL=$? if [ $RETVAL -eq 0 ]; then echo "done" cleanup fi return $RETVAL } restart() { echo -n "Restarting $PROG process: " $DAEMON restart RETVAL=$? if [ $RETVAL -eq 0 ]; then echo "done" else echo "error" fi return $RETVAL } status() { $DAEMON status RETVAL=$? return $RETVAL } reload() { echo -n "Reloading $DAEMON process: " $DAEMON reload RETVAL=$? if [ $RETVAL -eq 0 ]; then echo "done" else echo "error" fi return $RETVAL } check() { echo -n "Checking target status: " $DAEMON check RETVAL=$? if [ $RETVAL -eq 0 ]; then echo "OK" else echo "NG" fi return $RETVAL } config() { echo -n "Checking configuration file: " $DAEMON config RETVAL=$? if [ $RETVAL -eq 0 ]; then echo "OK" else echo "ERROR" fi return $RETVAL } cleanup() { rm -rf $LOCKFILE } # Prefer for Running script if [ ! -x $DAEMON ]; then echo "$DAEMON does not exist!" exit -1 fi # Privilege check if [ `id -u` -ne '0' ]; then echo "This script must run as root." exit -1 fi case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; check) check ;; status) status ;; config) config ;; condrestart) stop sleep 1 start ;; *) echo "Usage: $0 {start|stop|restart|reload|check|status|config|condrestart}" RETVAL=-1 esac exit $RETVAL