loadproc in bootscript function

Sergey Ostrovsky sostrovsky at snip.net
Fri Nov 24 05:10:40 PST 2000


Dieter Scholz wrote:

> Hey,
>
> at the moment I try to understand the bootscripts of my LFS 2.4.2 system,
> but I'm not a bash guru.
>
> So, here's my question:
>
> I don't know, what's happening in the loadproc (and in the related killproc)
> function in the file functions.
>
> What I've figured out so far:
>
> The function starts by checking if the necessary parameter (the name of the
> program) is available.
> Then it stores the basename of the programm, we want to start in the
> variable base.
> That's ok.
>
> After that the result of the pidof command is stored in pidlist. pidof
> returns process IDs.
>
> man pidof says -o excludes process ID's ($$ -> process of the running shell,
> %PPID -> process of pidof (right?) and $PPID -> what's that??? are
> excluded); -x means that the process ID of the shell should be echoed, if we
> want to start a script.
>
> The result should be a process ID of the program we want to start, am I
> right? But how can there be a process ID, if the program doesn't run (we
> havn't started it yet)?
>
> The for-loop fills $pid with the result of pidlist (a process number), if
> there ist a corresponding directory in /proc.
>
> Then we test if pid is not empty (process/program is running) and if it runs
> we start it again and check the return value ????????????????
>
> Ok, the script works, so I'm wrong. What is my mistake.
>
> Thanks in advance, Dieter
>
> --
> Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
> and put unsubscribe in the subject header of the message

You got everything right, except you did not notice bang(exclamation) in [ ! -n
"$pid ].
All that mess before was just to make sure the process with such a name is not
running already.

Sergey Ostrovsky.



-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the lfs-dev mailing list