Skip site navigation (1)Skip section navigation (2)
Date:      28 May 2001 21:55:22 +0200
From:      Cyrille Lefevre <clefevre-lists@noos.fr>
To:        Ernst de Haan <ernst@jollem.com>
Cc:        OKAZAKI Tetsurou <okazaki@FreeBSD.ORG>, Peter Pentchev <roam@orbitel.bg>, ports@FreeBSD.ORG
Subject:   Re: No pre- or post-deinstall target?
Message-ID:  <vgmluu39.fsf@gits.dyndns.org>
In-Reply-To: <20010528112524.A12023@c187104187.telekabel.chello.nl>
References:  <20010528101937.A9039@c187104187.telekabel.chello.nl> <20010528113238.E8450@ringworld.oblivion.bg> <867kz1c1ln.wl@dolphin.be.to> <20010528110932.A9375@c187104187.telekabel.chello.nl> <20010528112524.A12023@c187104187.telekabel.chello.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Ernst de Haan <ernst@jollem.com> writes:

> > Hmm, I will need to stop the Orion server *before* all files in pkg-plist are
> > deleted, cause I will use the installed 'orionctl' script to stop the server.
> > This will also delete the PID file (/var/run/orion.pid)...
> 
> I just wrote a simple pkg-deinstall file:
> 
>    #!/bin/sh
>    PID_FILE=/var/run/orion.pid
>    if [ -e ${PID_FILE} ]; then
>            echo -n "Orion is still running."
>            /bin/kill `cat ${PID_FILE}`
>            rm -f ${PID_FILE}
>            echo " Stopped."
>    fi

this could be done using @unexec at the beginning of the pkg-plist file
such as :

@unexec [ -e /var/run/orion.pid ] && { echo killing orion.; kill `cat /var/run/orion.pid`; rm -f /var/run/orion.pid; }

an alternative would be to use killall such as :

@unexec echo killing orion.; killall orion; rm -f /var/run/orion.pid

FYI, the pkg-plist file is parsed and executed sequencially.

Cyrille.
--
home: mailto:clefevre@redirect.to   UNIX is user-friendly; it's just particular
work: mailto:Cyrille.Lefevre@edf.fr   about who it chooses to be friends with.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vgmluu39.fsf>