Bug 196530 - new init script that allows for more than one daemon
Summary: new init script that allows for more than one daemon
Alias: None
Product: Fedora
Classification: Fedora
Component: ez-ipupdate   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jeff Layton
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2006-06-24 01:15 UTC by Jeff Layton
Modified: 2014-06-18 07:35 UTC (History)
3 users (show)

Fixed In Version: 3.0.11-0.12.b8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-02-10 15:15:12 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to allow for starting/stopping/status of multiple daemons (2.36 KB, patch)
2006-06-24 01:15 UTC, Jeff Layton
no flags Details | Diff
proposed init script 2 (2.46 KB, text/plain)
2006-06-30 15:04 UTC, Jeff Layton
no flags Details
proposed init script 3 (2.55 KB, text/plain)
2006-06-30 18:18 UTC, Jeff Layton
no flags Details
proposed init script 4 (2.79 KB, text/plain)
2006-07-01 11:15 UTC, Jeff Layton
no flags Details
proposed script 5 (2.80 KB, text/plain)
2006-07-01 13:23 UTC, Jeff Layton
no flags Details
proposed script 6 (2.80 KB, text/plain)
2006-07-02 11:16 UTC, Jeff Layton
no flags Details
specfile 1 (5.62 KB, text/plain)
2006-07-02 11:19 UTC, Jeff Layton
no flags Details

Description Jeff Layton 2006-06-24 01:15:37 UTC
I have a couple of different domains that I point to my cable modem, and the
current ez-ipupdate init script only allows for a single running daemon. The
attached patch changes the init script to loop over a series of files in an
/etc/ez-ipupdate directory and start daemons for each. It also shuts down the
daemons and handles the status for them as well.

If this is accepted, we'll also probably need change the packaging as well to
create an /etc/ez-ipupdate directory and put the default config file in there.
We might also want to add a comment to the default config that recommends making
the cache-file unique.

Comment 1 Jeff Layton 2006-06-24 01:15:38 UTC
Created attachment 131474 [details]
patch to allow for starting/stopping/status of multiple daemons

Comment 2 Jeff Layton 2006-06-24 01:18:51 UTC
If you think this general approach is acceptable, let me know and I'll see if I
can roll a specfile patch as well to do the needed changes there.

Comment 3 Ville Skyttä 2006-06-26 20:19:47 UTC
I think this definitely does have potential, yes.

There are some issues with the current implementation though, eg. files in the
config dir need to be whitelisted: load only *.conf files in order to skip eg.
*.rpmsave and friends, *~ etc, and probably keep stricter track of the
ez-ipupdate processes started by the init script in order to not blow away other
possibly independently started ones.

Debian appears to be doing similar things; see ez-ipupdate-3.0.11b8/debian/init
after a rpmbuild -qp (or make prep if you're working with FE CVS).  I think
their implementation covers this stuff pretty well, including starting only
processes that have been marked as to-be-daemonized in the respective config files.

Could you have a look at the Debian stuff and revise the patch based on it? 
Also, ideas how to cleanly upgrade existing configs to the new setup are welcome.

By the way, I'm not actively using ez-ipupdate myself, because I need something
that works behind a firewall at the moment (ddclient).  So in case you have an
Extras account set up, maintainership is up for grabs...

Comment 4 Jeff Layton 2006-06-30 11:26:34 UTC
All the changes you mention seem reasonable. I had actually considered a few of
them before, but I didn't really need them, and didn't see the point unless you
were interested in incorporating a new init script. I'll have a look at the
Debian one and see about incorporating those changes.

Also, I just recently got my extras acct set up! So I'd be willing to take over
maintainership of the package as well. What needs to be done besides changing
ownership in the owners file?

Comment 5 Ville Skyttä 2006-06-30 12:35:29 UTC
Changing ownership is just a matter of changing owners.list and reassigning open
Bugzilla bugs.  This is the only open bug report against ez-ipupdate, so I'll
take care of it right now, and you can go ahead and make the owners.list change.

BTW, if the transition from the old init mechanism can't be made all smooth and
transparent, I'd recommend shipping the new stuff for FC6+ only.

Comment 6 Jeff Layton 2006-06-30 12:43:07 UTC
Thanks -- I went ahead and changed the owners list...

I'm thinking for the transition what I will probably do is use %pre or %post
scripts to move ez-ipupdate.conf to /etc/ez-ipupdate.d (or whatever I settle on)
and rename it to something like "default.conf". I'll need to work out the
details and test it to make sure it goes smoothly, but I think something like
that should work.

Comment 7 Jeff Layton 2006-06-30 15:04:30 UTC
Created attachment 131815 [details]
proposed init script 2

Here's a second proposed init script that I think addresses all of the concerns
that Ville had before. Ville, any comments on this?

If this looks good, I'll see what I can to to add some pre/post magic to make
transitioning to the new scheme seamless for the typical user.

Comment 8 Ville Skyttä 2006-06-30 17:48:46 UTC
Looks mostly good, but some comments based on just skimming the script, not
actually tested:

- the pidfile: and config: lines in the top commentary are now stale, and based
on the fact that there has been a typo (by yours truly) in the pidfile: line for
ages without anyone noticing, they should probably be just removed.

- if I understand correctly, the pidfiles are now named *.conf which is unusual
and could be somewhat confusing, how about using "$(basename foo.conf .conf).pid"?

- reload() needs similar adjustments as stop()

- the status action needs *.conf whitelisting (instead of *)

- I would add LSB compliant action aliases as appropriate (try-restart =>
condrestart, force-reload => reload), see /usr/share/fedora/template.init if you
have fedora-rpmdevtools installed and

Comment 9 Jeff Layton 2006-06-30 18:18:11 UTC
Created attachment 131822 [details]
proposed init script 3

Good call on all counts. Here's an updated script that I think incorporates all
of your suggestions. I've briefly tested it and all the modes seem to work.


Comment 10 Ville Skyttä 2006-06-30 18:44:09 UTC
Looks even better (still not tested but I trust you do test it).  Still a few
comments, some of them being on the nitpicky side:

- the pidfile: and config: lines in the top commentary were used by some old
init script tool (linuxconf? I don't remember), AFAIK the plural pidfiles: and
configs: mean nothing to it.  I think I'd still remove them, but of course they
can be useful for humans as they are now.

- the for ... loops in start(), stop() and reload() should probably have a
safeguard that tests that the current file is readable like the status action
does.  Otherwise things may break if the dirs exist but do not contain any files.

- the start(), stop() and reload() return values, or actually what $RETVAL is
after they're run, doesn't seem to be correct; $RETVAL remains to be set to
whatever was returned by the last operation on a particular daemon in a loop, so
if the last one succeeds and there were failures before it, the failures are not
reflected in the overall return value of the init script.  Fixing it could be a
bit tedious, but in case you feel like it...

Comment 11 Jeff Layton 2006-07-01 11:15:55 UTC
Created attachment 131837 [details]
proposed init script 4

All those suggestions seem reasonable so I went ahead and incorporated them.
I'd rather get this right the first time than have to revisit it again later.

Please have a look when you get the chance, and let me know what you think.

Comment 12 Jeff Layton 2006-07-01 13:23:04 UTC
Created attachment 131838 [details]
proposed script 5

Slightly revised script -- add .pid to end of pidfiles. Started looking over
the specfile updates that will need to be made with this too, but I'm not
through with that as of yet.

Comment 13 Ville Skyttä 2006-07-01 13:57:38 UTC
Apart from stop() and reload() testing for readability of a wrong file (should
be $pidfile, not $ez_configfile), looks good to me.

Comment 14 Jeff Layton 2006-07-02 11:16:38 UTC
Created attachment 131850 [details]
proposed script 6

Doh! Good catch. This should fix that and also the $ez_name in those sections.

Comment 15 Jeff Layton 2006-07-02 11:19:39 UTC
Created attachment 131851 [details]
specfile 1

Here's the current version of the specfile that I'm working with. This seems to
do a smooth upgrade to the new scheme on the box where I've tested it. Can you
also give this a once over and let me know what you think?

There is one question I have. The version string here is pretty complex and I'm
not sure how I should change the version number here. What is the versioning
scheme that you were using for these packages?

Comment 16 Ville Skyttä 2006-07-02 16:11:17 UTC
The init script looks ok to me now.

Looking at the specfile, there seems to be a problem with %post: one should try
hard to make it return a zero error code; otherwise on upgrades the transaction
aborts prematurely and the old one is not removed, and causes scary errors on
initial install too (untested).  For example, the last line returns 1 on new
installs.  I would add the whole shebang after chkconfig --add inside a "if [ $1
-gt 1 ] ; then ... fi" and remove the [ $1 -ge 1] check from the last line.  The
migration stuff is for upgrades anyway.

I see you removed some explicit %defattrs from the %files section; note that now
some of the example-*.conf doc files are installed as executable which needs
fixing some other way if you don't like the %defattr(644,root,root,755).

The version number scheme is the standard one from the package naming guidelines
for pre-release packages (I think that's what "b8" means).  See
for more info and rationale.  You seem to have nailed it exactly right in your
revised specfile ;)

Comment 17 Jeff Layton 2006-07-02 21:14:24 UTC
Ok, I've gone ahead and incorporated your most recent set of suggestions and
have committed the changes to devel CVS. If you think the most recent versions
of the files look OK, then I'll go ahead and do a plague build of it.

Comment 18 Ville Skyttä 2006-07-02 21:55:35 UTC
The test in %post should be -gt 1, -ge 1 is always true.  (Another mistake of
mine originally, it seems.)

Also, if I was writing the specfile today, I'd not remove the user and group at
all.  But both removing them and leaving them have their upsides and downsides,
and IIRC there's no hard rule either way, so it's your call.

Comment 19 Jeff Layton 2006-07-02 23:49:51 UTC
Ahh good catch. I had actually noticed the argument discrepancy before and meant
to go back and fix it.

I also tend to agree with you about not removing the user and group. I prefer to
leave them in place so that if there are stray files laying around they don't
end up being owned by a different user later.

I think this should just about do it. I'll go ahead and kick off a plague build
with all of these changes. Many thanks for the guidance :-).

If there are no complaints after a week or two with the devel package, then I'll
probably go ahead and roll these changes into FC5's tree as well.

Comment 20 Ville Skyttä 2006-07-03 06:31:10 UTC
Right, that's why I consider removing created users/groups bad too.  By the way,
now that they're no longer removed, the Requires(postun) on userdel/groupdel can
go too.

The plan sounds good, thanks for your patience :)

Comment 21 Jeff Layton 2007-02-10 15:15:12 UTC
Long overdue update. The new init script is in place in fc6 and seems to be
fine. I've also removed the "requires(postun)" in the devel tree and in fc6, but
am not planning a new build for it since it really shouldn't affect the package.

I decided not to change this in fc5 after all, but any newer FC releases should
get it.

Note You need to log in before you can comment on or make changes to this bug.