Skip to content
Snippets Groups Projects
Select Git revision
  • 3a6ab55266b0b92a4293a258c2e8300ec93a88fd
  • master default protected
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • servers
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

webpack.config.js

Blame
  • wardend 3.90 KiB
    #!/bin/bash
    #
    # 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.1"
    
    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() {
    	/bin/ps axo pid,comm | grep -q "warden-serv*"; RET_VAL=`echo $?`
    	if [ $RET_VAL -eq 0 ]; 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