#!/bin/bash


if /bin/ps aux|grep fwww |grep -v grep|grep bin_dir >/dev/null ; then
    echo "Stopping fwww ..."
    if type killall 2>/dev/null; then
        killall fwww
    else
        if type pkill 2>/dev/null; then
            pkill fwww
        fi
    fi
fi

if /bin/ps aux|grep lighttpd |grep -v grep |grep conf_dir >/dev/null ; then
    echo "Stopping lighttpd ..."
    if type killall 2>/dev/null; then
        killall fwww
        killall lighttpd
    else
        if type pkill 2>/dev/null; then
            pkill fwww
            pkill lighttpd
        fi
    fi
fi

sleep 3
pids=`/bin/ps aux|grep fwww|grep bin_dir|awk '{print $2}'`
if [[ ! -z $pids ]]; then
    kill -9 $pids
fi

