On 3/18/2011 5:56 PM, Vincent Ladeuil wrote:
> As a data point, in mass-import-in-etc we do:
>
> restart)
> echo -n "Restarting $NAME"
> d_stop
> sleep 1
> d_start
> echo "."
> ;;
>
> d_stop being:
>
> d_stop() {
> start-stop-daemon --stop --pidfile $PIDFILE --exec /usr/bin/python
> }
>
> which by default send a SIGTERM.
>
> So we wait 1 second for the mass_import.py to shut down before starting it again.
>
> 'graceful_stop' now is a different beast but that;s not what this proposal is about.
Wouldn't it make more sense to actually wait for the pid to disappear?
Note, though, if it is something that is listening on a socket, etc. You
often don't have to wait for it to die completely before restarting, as
long as it won't try to respond to new requests.
I don't think mass_import follows that specific logic, but as long as it
won't try to start new imports, you can bring up the next process, even
if this one isn't dead yet.
I wonder how scripts like apache's start/stop/restart logic work, since
they certainly don't just sleep expecting the service to stop in that time.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 3/18/2011 5:56 PM, Vincent Ladeuil wrote:
> As a data point, in mass-import-in-etc we do:
>
> restart)
> echo -n "Restarting $NAME"
> d_stop
> sleep 1
> d_start
> echo "."
> ;;
>
> d_stop being:
>
> d_stop() {
> start-stop-daemon --stop --pidfile $PIDFILE --exec /usr/bin/python
> }
>
> which by default send a SIGTERM.
>
> So we wait 1 second for the mass_import.py to shut down before starting it again.
>
> 'graceful_stop' now is a different beast but that;s not what this proposal is about.
Wouldn't it make more sense to actually wait for the pid to disappear?
Note, though, if it is something that is listening on a socket, etc. You
often don't have to wait for it to die completely before restarting, as
long as it won't try to respond to new requests.
I don't think mass_import follows that specific logic, but as long as it
won't try to start new imports, you can bring up the next process, even
if this one isn't dead yet.
I wonder how scripts like apache's start/stop/restart logic work, since
they certainly don't just sleep expecting the service to stop in that time.
John enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk2 EaeQACgkQJdeBCY SNAAO31wCgnV3zG PbZfQ+adwyDTUPt v7JY xnfUk5+ y53codEAAE
jeQAoMtB2zL7sD7
=zlRY
-----END PGP SIGNATURE-----