[Rear-users] rear already running error

Jeroen Hoekx jeroen.hoekx at hamok.be
Thu Apr 28 18:42:32 CEST 2011


Hello Schlomo,

On 28 April 2011 18:38, Schlomo Schapiro <schlomo at schapiro.org> wrote:

> This is the rescue system and not the original system. What you are
> trying to tell us is that the pidof stuff won't work in the rescue
> system and I guess nobody checked that.
>
> Since /usr/bin is a symlink IMHO the fix would be to make sure that /bin
> is listed first in $PATH so that type -p will find the "real" script.
>
> I put in a fix for that (/etc/profile in rescue system), but need to
> test it further.

Do we really need all this complicated stuff? According to the man
page, pidof works just fine by name. A full path is not required. We
don't even need $SCRIPT_FILE anymore.

This was my patch:
=== modified file 'usr/sbin/rear'
--- usr/sbin/rear	2011-04-28 15:25:35 +0000
+++ usr/sbin/rear	2011-04-28 16:31:24 +0000
@@ -58,16 +58,13 @@
 	exit 1
 fi

-# get full path to main script
-SCRIPT_FILE="$(readlink -f $(type -p "$0" || echo "$0"))"
-
 if ! type -p pidof >/dev/null ; then
 	echo 1>&2 "** ERROR **        Required program 'pidof' missing"
 	exit 1
 fi
 # do not run if another instance is running. pidof -x will always
report at least $$
-if [ $$ != "$(pidof -x "$SCRIPT_FILE")" ] ; then
-        echo 1>&2 "** ERROR **        $SCRIPT_FILE is already
running, not starting again"
+if [ $$ != "$(pidof -x "rear")" ] ; then
+        echo 1>&2 "** ERROR **        ReaR is already running, not
starting again"
         exit 1
 fi

Jeroen




More information about the rear-users mailing list