jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [etc/] [init.d/] [statistiky] - Rev 3 Go to most recent revision

Compare with Previous - Blame - Download


#!/bin/bash

FLAGS="defaults 95"

function start_rates()
{
    nohup /opt/statistiky/collect_rates.sh &>/dev/null &
    echo $! >/var/run/collect_rates.sh.pid
}

function start_arp()
{
    nohup /opt/statistiky/collect_arp.sh &>/dev/null &
    echo $! >/var/run/collect_arp.sh.pid
}

function start_ping()
{
    nohup /opt/statistiky/collect_ping.sh &>/dev/null &
    echo $! >/var/run/collect_ping.sh.pid
}
function start_crusader()
{
    nohup /opt/statistiky/collect_crusader.sh &>/dev/null &
    echo $! >/var/run/collect_crusader.sh.pid
}
function start_system()
{
    nohup /opt/statistiky/collect_system_info.sh &>/dev/null &
    echo $! >/var/run/collect_system_info.sh.pid
}
function start_temp()
{
    nohup /opt/statistiky/collect_temp.sh &>/dev/null &
    echo $! >/var/run/collect_temp.sh.pid
}

function stop_rates()
{
        kill `cat /var/run/collect_rates.sh.pid`
        rm -f /var/run/collect_rates.sh.pid
}
function stop_arp()
{
        kill `cat /var/run/collect_arp.sh.pid`
        rm -f /var/run/collect_arp.sh.pid
}
function stop_ping()
{
        kill `cat /var/run/collect_ping.sh.pid`
        rm -f /var/run/collect_ping.sh.pid
}
function stop_crusader()
{
        kill `cat /var/run/collect_crusader.sh.pid`
        rm -f /var/run/collect_crusader.sh.pid
}
function stop_system()
{
        kill `cat /var/run/collect_system_info.sh.pid`
        rm -f /var/run/collect_system_info.sh.pid
}
function stop_temp()
{
        kill `cat /var/run/collect_temp.sh.pid`
        rm -f /var/run/collect_temp.sh.pid
}

case "$1" in
    start)
        shift
        if [ $# -eq 0 ]; then
            start_rates
#            start_arp
            start_ping
#            start_crusader
#            start_system
#            start_temp
        else
            case "$1" in
                rates)
                    start_rates
                    ;;
                arp)
                    start_arp
                    ;;
                ping)
                    start_ping
                    ;;
                crusader)
                    start_crusader
                    ;;
                system)
                    start_system
                    ;;
                temp)
                    start_temp
                    ;;
                test)
                    echo "start test"
            esac
        fi
    ;;
    stop)
        shift
        if [ $# -eq 0 ]; then
            stop_rates
#            stop_arp
            stop_ping
#            stop_crusader
#            stop_system
#            stop_temp
        else
            case "$1" in
                rates)
                    stop_rates
                    ;;
                arp)
                    stop_arp
                    ;;
                ping)
                    stop_ping
                    ;;
                crusader)
                    stop_crusader
                    ;;
                system)
                    stop_system
                    ;;
                temp)
                    stop_temp
                    ;;
                test)
                    echo "stop test"
            esac
        fi
        
    ;;
    start_rates)
        start_rates
    ;;
    start_crusader)
        start_crusader
    ;;
    stop_crusader)
        stop_crusader
    ;;
    *)
        echo "Usage: /etc/init.d/statistiky start | stop"
        exit 1;
esac

Powered by WebSVN 2.2.1