Adam R. B. Jack wrote:
I just committed some updates to the gump3 branch that "on my machine",
allow me to run on cygwin+winxp+python2.4-win32. Could some people try and
follow

Some cygwin testing:

Thanks!

$ bash gump webgump
hostname: invalid option -- s
Try `hostname --help' for more information.
./bin/debug: line 24:
/cygdrive/f/data/Python/Gump3-SVN/webgump/lib/apache2-inst
all/current/bin/httpd: No such file or directory

ah right, I suspect that the "webgump" code will currently only "work on my machine", and even that is dubious. I have no idea whether we should move forward with it. Basically for me it mostly depends on how much time Stefano and fellow cocooners want to invest in dynagump, 'cuz I certainly can't get that implemented on my own.


$ bash gump kill
ps: unknown option -- o

ugh. I forgot; one pretty much cannot count on ps working well on cygwin at all. -o is probably a GNU extension. We'll probably have to grep/sed/awk our way through this. "Please file an issue" kind of thing ;)


BTW: On posix I was able to lock the "pid file" and test if that file was
still locked, i.e. the process was running. For cron based automatic runs I
think that is nicer than requiring a manual kill. Something (IMHO) to add to
the wish list sometime.

Well, I'm no expert, but I believe that file locking is usually not considered very reliable or portable. At least the sysvinit packages that float around various linux distributions inspect /proc and compare with a pid file instead of using locking. If its worked for unix since sysv, it might make sense just to copy. In fact, I basically took a look at the sh functions sourced from /etc/init.d files and tried to copy what they did. Just need to figure out how to interact with /proc on cygwin and we can lose the use of "ps" and be portable and robust and all. I.e. (from /lib/lsb/init-functions on my machine, snippet copyright Chris Lawrence, all rights reserved)


pidofproc () {
    local pidfile line i pids= status
    set -- `POSIXLY_CORRECT=1 getopt "p:" $*`
    pidfile=

    for i in $*; do
        case $i in
            -p)  pidfile=$2; shift 2;;
            --)  shift; break;;
        esac
    done

    if [ -z "$pidfile" ]; then
        pidfile=/var/run/$(basename "$1").pid
    fi

if [ -f "$pidfile" ]; then
read -d "" line < "$pidfile"
for i in $line; do
if [ -z "$(echo $p | sed 's/[0-9]//g')" -a -d "/proc/$i" ]; then
pids="$i $pids"
fi
done
if [ -n "$pids" ]; then
echo "$pids"
return 0
else
return 2 # program is dead and /var/run pid file exists
fi
elif [ -x /bin/pidof ]; then
/bin/pidof -o %PPID $1
status="$?"
[ "$status" = 1 ] && return 3 # program is not running
return 0
else
return 4 # program or service is unknown
fi
}


Do you have any pointers to docs where they suggest doing things differently?


cheers!


Leo

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to