Skip to content
Snippets Groups Projects
Commit 5726bf7a authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

odstraneny stare soubory pro warden-server-1.0.0 (warden-alive, wardend, warden-server.pl)

parent 5a51b336
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/perl
# Pri pouziti Apache + mod_perl se tento soubor nepouziva
#
# warden-alive
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
# Author(s): Jan Mach <jan.mach@cesnet.cz>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Cesnet z.s.p.o nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the Cesnet z.s.p.o or contributors be liable for
# any direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
our $VERSION = "0.1";
my $rv = `ps aux | grep "/usr/bin/perl -w /opt/warden-server/bin/warden-server.pl" | grep -v grep | grep -v process-alive | wc -l`;
if ($rv) {
print "WARDEN OK: Warden server is running\n";
}
else {
print "WARDEN CRITICAL: Warden server is not running\n";
};
This diff is collapsed.
#!/bin/bash
# Pri pouziti Apache + mod_perl se tento soubor nepouziva
#
# wardend
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
# Author(s): Tomas PLESNIK <plesnik@ics.muni.cz>
# Jan SOUKAL <soukal@ics.muni.cz>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Cesnet z.s.p.o nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the Cesnet z.s.p.o or contributors be liable for
# any direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
### BEGIN INIT INFO
# Provides: wardend
# Required-Start: $local_fs $network $syslog $time
# Required-Stop: $local_fs $syslog $time
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start the Warden server
# Description: Starts or stops server for exchange of events
# among CSIRT teams
### END INIT INFO
VERSION="0.2"
DAEMON="/usr/local/bin/warden-server.pl"
PID_FILE="/var/run/warden-server.pl.pid"
LOCK_FILE="/var/lock/warden-server"
SCRIPTNAME=`basename "$0"`
# check if daemon is present and executable
test -x $DAEMON || exit 0
if [ $UID -ne 0 ]; then
echo "You must be root for runnnig this script!"
exit 1
fi
usage() {
echo "Usage: $0 [start|stop|status|restart|force-stop]"
exit 1
}
check_status() {
if /bin/ps axo pid,comm | grep -q "warden-serv*"; then
STATUS=1 # true - warden is running
else
STATUS=0 # false - warden is not running
fi
}
get_pid() {
PID=`ps axo pid,comm | grep "warden-serv*" | sed 's/^ \{1,4\}//g' | cut -f 1 -d " "`
return $PID
}
warden_start() {
check_status
if [ $STATUS -eq 1 ]; then
get_pid PID
echo "Warden server daemon is running (pid $PID)."
else
logger -s "Starting Warden server daemon ..."
$DAEMON
PID=`cat $PID_FILE`
logger -s "Warden server daemon is running (pid $PID)."
touch $LOCK_FILE
fi
}
warden_stop() {
check_status
if [ $STATUS -eq 1 ]; then
logger -s "Stopping Warden server daemon ..."
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
kill -1 $PID
rm -f $LOCK_FILE
logger -s "Warden server daemon (pid $PID) is stopped."
else
echo "Unable to stop Warden server daemon. Try to use: $SCRIPTNAME force-stop"
fi
else
echo "Warden daemon is NOT running."
fi
}
warden_status() {
check_status
if [ $STATUS -eq 1 ]; then
get_pid PID
echo "Warden daemon is running (pid $PID)."
exit 0
else
echo "Warden daemon is NOT running."
exit 1
fi
}
warden_force_stop() {
logger -s "Force stopping Warden server daemon ..."
get_pid PID
kill -9 $PID 1>/dev/null 2>&1
if [ -e $PID_FILE ]; then
rm -f $PID_FILE
fi
if [ -e $LOCK_FILE ]; then
rm -f $LOCK_FILE
fi
}
case $1 in
status)
warden_status
;;
start)
warden_start
;;
stop)
warden_stop
;;
force-stop)
warden_force_stop
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
usage
;;
esac
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment