site  contact  subhomenews

More efficient handling of one-shot services

February 28, 2018 — BarryK

In the latest release of Quirky Xerus64, version 8.5, /etc/eventmanager has this line:

PE_SERVICE_MANAGER='network%cups-net-fix'

/etc/init.d/cups-net-fix is a service that will run after the network is up. This is handled by /etc/rc.services at bootup.

However, 'cups-net-fix' is a "one-shot" service, just runs at startup, no daemon in it, no "stop" option. So, once started, the pup_event Service Manager is not required anymore to monitor and stop it when the network goes down.

So, I have added a bit of extra code to /etc/rc.d/rc.services and /etc/rc.d/rc.services_ipc, to stop the Service Manager in the cases of one-shot services, after they have started. This improves efficiency.

The enhancement is explained in the latest document here, with the new code shown in dark-blue (update 180228):

http://bkhome.org/docs/pup_event/pup_event-service-management.htm

For anyone who wants use this enhancement, just append "ONESHOT" to the service name in PE_SERVICE_MANAGER:

PE_SERVICE_MANAGER='network%cups-net-fixONESHOT'

I did consider automating it, by searching for "stop)" in a service script, and if not exist then it is one-shot. However, decided that might not catch them all.

Tags: easy, quirky