[Coldstuff] Ports with Genesis & ColdC

Brandon Gillespie coldstuff@cold.org
Thu, 21 Feb 2002 17:22:22 -0700


Based off the fact that root owns your backups folder, and that things
are actually going into it; I'm guessing that you are running genesis
as root?  This shouldn't actually be a problem for removing the
directory, but its not a good idea to be running as root.  YOu may
want to consider the setuid option to switch genesis to yourself
(jonathan)...

The init script I use on the Cold Dark does this, it is as follows.
As for your problem, you are probably best contacting me or somebody
on the Cold Dark to work through it real-time...

-Brandon

--------------------------------------------------------------------
#!/bin/bash

hostname=ice.cold.org
user=tcd
group=tcd
base=/svc/tcd/db
prog=./bin/genesis
pidfile="$base/logs/genesis.run"
args="-s199x10 -n $hostname -u$user -g$group -f"

ulimit -c 52428800
umask 002

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

find_process ( ) {
    pid=$1
    if [ "$pid" = "" ]; then
        if [ -f $pidfile ]; then
            pid=`cat $pidfile`
        fi
    fi
    if [ "$pid" != "" ]; then
        ps -fp $pid | tail -1 | grep $prog
    fi
}

case $1 in
start)
    cd $base
    if [ "`find_process`" != "" ]; then
        echo "$prog alread appears to be running, aborting!"
        exit
    fi
    echo "Starting $prog..."
    ulimit -a
    ($prog $args )2>&1 >> $base/logs/init.log&
    ;;
stop)
    if [ "`find_process`" = "" ]; then
        echo "Cannot find $prog, unable to shutdown!"
    else
        pid=`cat $pidfile`
        echo "Sending term signal to $prog($pid)..."
        kill -TERM $pid
        wait=5
        tries=60 # how many $wait second sleeps until we finally giveup?
        while [ $tries -gt 0 ]; do
            tries=`expr $tries - 1`
            echo "[kill $prog] Waiting $wait seconds..."
            sleep $wait
            if [ "`find_process $pid`" = "" ]; then
                echo "[kill $prog] process is gone, goodbye."
                exit
            fi
        done
        echo "[kill $prog] unable to shutdown, possible corruption!"
    fi
    ;;
*)
    echo "Syntax: $0 {start | stop}"
    exit
esac