viewing paste Unknown #17345 | Bash

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/bin/bash
 
cd `pwd`
 
h_server="./HashieldServer.exe"
h_server_on="/usr/bin/mono ./HashieldServer.exe"
 
 
hashield_start()
{
    stamp=`date +"%m%d%y-%H%M%S"`
    ${h_server_on} > ./hashield_stdout.log 2> ./hashield_stderr.log &
 
    echo $! > ${h_server}.pid
    echo "[${stamp}] Hashield server (re)started." >>./hashield_runlog.log
}
 
 
if [ -f ${h_server}.pid ]; then
    pid=`cat ${h_server}.pid`
    ps ax | grep "${h_server}" | grep "${pid}" > /dev/null
    if [ $? -ne 0 ]; then
        `hashield_start`
    fi
else
    `hashield_start`
fi
Viewed 655 times, submitted by milk.