Description of Problem:
The new network/netfs restart logic of apmd is really nice, but shouln't
the script also check if the service was actually running and/or if it's
enabled in chkconfig, at least for netfs. Actually, I would prefer shutdown
to be unconditional, and startup to be conditional on chkconfig.
Also, similar setup for ypbind would be useful.
Version-Release number of selected component (if applicable):
It already is. Use the NETFS_RESTART parameter in /etc/sysconfig/apmd.
You didn't really read the bug description, did you?
NETFS_RESTART="yes" will cause netfs to be started when resuming regardless of
whether it was actually active, or enabled via chkconfig, when suspending. I
think this is wrong as the state should remain the same after suspend + resume.
Also, you shoudn't have to change several config files to disable or enable a
service, 'chkconfig' should be enough.
To put it differently, the values of these flags should in my opinion be
intepreted as follows:
<service>_RESTART="no" : Leave <service> alone.
<service>_RESTART_"yes": Restart <service> if it was already running and/or
'chkconfig <service>' is true.
No change after upgrade to Red Hat Linux 7.2.
Created attachment 37743 [details]
The attached patch introduces chkconfig support in apmscript. The services will
be always be stopped on suspend, but restarted on resume only if enabled via
'chkconfig' - all provided that the appropriate flag is set in
/etc/sysconfig/apmd, of course.
This means that the system will be brought back to the default state after
suspend, i.e. the same one as after a reboot. You could say that this is also
wrong, and that the state shouldn't be changed at all, but in many causes I want
a reset like this as I often disconnect the machine from the network while it's
I've changed this in -36, differently, though.
It returns things to the state they were in at suspend time; I think this is
preferrable (do you want to start netfs even when you're on a train/plane? If
not, simply "service netfs stop" before suspending), and more consistant with
the other things apmd does.
Created attachment 37744 [details]
Introduce ypbind restart in apmscript
Use RESTORESERVICES (introduced in -35) to restart ypbind... special-casing it
Didn't notice your last change, there, until after I had attached another patch;
it will introduce similar restart support for "ypbind", but in the manner of my
first patch, not the updated logic.
Anyhow, your update sounds better; I guess it's not available for download just
yet so that I can test it.
The only argument for my approach is that it might save the day if you issue
"netfs start" or similar by hand, then forget to stop the service, but the main
reason for updating the way I did was that implementing proper state handling
seemed like more work.
I'm looking at the apmscript in release 35 now... I rather like the way it's
structured, but can it actually work? It seems to me that e.g. "/sbin/service
netfs status" will return successfully even when the service has been stopped,
but perhaps I'm missing something obvious. (But I think it's really a
netfs/initscripts bug, not an apmd one, if I'm right.)