[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [master 1/2] Restarting anaconda.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/19/2010 07:49 AM, Ales Kozumplik wrote:
> Provides a shell script that restarts stage2 anaconda by killing it along
> with everything it has spwawned (X server, metacity).
> 
> This also needs some support by the loader.

>  
> +int restart_anaconda() {
> +    if (access("/tmp/restart_anaconda", R_OK))
> +        return 0;
> +    puts("Restarting Anaconda.");
> +    return 1;
> +}

I would remove the /tmp/restart_anaconda file here as well. Better to
let the receiver remove the trigger than to depend on a timeout in the
sender.

> +
> +RESTART_FILE=/tmp/restart_anaconda
> +LOADER_PID=`cat /var/run/loader.run`
> +ANACONDA_PID=`cat /var/run/anaconda.pid`

Wouldn't this work?

kill -s KILL -$ANACONDA_PID

Or am I missing something about anaconda's processes/threading?

> +
> +# this is how loader knows it should restart stuff
> +touch $RESTART_FILE

This should be done after the killing. Otherwise loader may restart on
top of the kill.

> +
> +# kill all anaconda descendants and anaconda itself
> +RESTART_VICTIMS=`anaconda_descendants` 
> +RESTART_VICTIMS+=' '$ANACONDA_PID
> +echo "killing processes: " $RESTART_VICTIMS
> +for child in $RESTART_VICTIMS; do
> +    kill -s KILL $child &>/dev/null
> +done
> +
> +# give loader some time to pick up the restart file 
> +sleep 1
> +rm -f $RESTART_FILE

As above, this should be in loader.

Also, it should probably wait until all the processes are really dead
before writing the $RESTART_FILE, but off the top of my head I'm not
sure of a nice way to do that in bash.


Good work on this, it should help cut down the development cycle
considerably!

- -- 
Brian C. Lane <bcl redhat com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS/XEvRF+jBaO/jp/AQJc5Af/RimUUFut1a8yt2gOZmfM8uRWUS2p9ONV
1u3bMPR41lHY+LLz1l5Ux84L8YIH0u4kKIS+R0ZNHwSOQEDLiQxEEHrrfCAZp2hl
hLDg+79A4TgbWyxu5cYIm3jRMX6m6ICD9gP4cQjIvXbBee0RKEs3iUUHFwzFlq8r
aV7h1nrfFjFJy3WRtL0H0b4HMVi7vfj/wYIiiJ0voj13mrmm1vSdPgYaKkuZ8w8K
GCKR3hhAlM77CIbC+8mdmooNpyf3vmuQFQ0I2a1L5t1hLpGcDJDR4zQ53wUdgbQA
+lCwH+m1UoC+3C+Z80MS+fomzTiBCsISph4PV+YFxIIGx4MVTe0g1g==
=QRoZ
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]