On Mon, Jan 12, 2009 at 01:17:59PM +0100, intrigeri wrote:
> Hello,
> 
> Tuomas Jormola wrote (09 Jan 2009 11:33:15 GMT) :
> > Naive sample implementation of this feature, not tested at all.
> > Maybe better use as inspiration rather than concrete
> > implementation...
> 
> This seems like a good start to implement an important missing
> feature. Great :)
> 
> As pointed out in your comments, the checkpidalive portability needs
> to be fixed; do you intend to do so at some point?
Quick check on Linux/AIX/Solaris/Mac OS X systems would suggest that
ps -A | awk '{print $1}' would give you the list of all the pids running
on the system. On HP-UX, it's ps -e. So maybe something like this could
be done (untested, and we should check at least how *BSD ps behaves)

function checkpidalive() {
        local pid="$1"
        [ -z "$pid" ] && return 2
        [ -d /proc/$pid ] && return 0
        local psargs
        local uname=`uname`
        case "$uname" in
                HP-UX) psargs="-e" ;;
                *)     psargs="-A" ;;
        esac
        ps $psargs | awk '{print $1}' | grep -q "^${pid}$"
        return $?
}

> Also, why is the hostname needed in the lock file name?
Well I thought that the lock directory might be shared among different
hosts that might all run rdiff-backup, and there might be similarily
named configs on these hosts. But if you hear the voice of reason in
your head, you'll notice that there's too many ifs and unnecessary
complexity involved. Just get rid of the hostname in the file name, it's
not needed at all :)

-- 
Tuomas Jormola <t...@solitudo.net>

Attachment: signature.asc
Description: Digital signature

Reply via email to