From: <jam...@te...> - 2002-08-28 12:58:16
|
> > This is one of those simple things that I rarely dig into though. It > > just works, so why bother understanding it? ;-) > > > > Anyway, in my RPMs I've gone under the assumption that you start it in > > runlevels where you want it to run and kill it in levels where you don't > > (thus network gets killed in level 1..actually everything gets killed > > there except S00single). I may be wrong, but it seems to work. Then > > again, so does Webmin! ;-) > > Looks like you are right .. all the other init scripts on my system have > their S links in rc3.d, rc4.d and rc5.d , and their K links in rc0.d , rc1.d > and rc6.d . So I'll make the Webmin RPM do the same thing .. You know it must have worked before because of the order in which the kill scripts are called. As in the /etc/rc.d/rc script you have the following comments: # First, run the KILL scripts. . . . # Now run the START scripts. So it was bascially killing webmin (though it was not there to be killed), and then restarting it (or really starting it for the first time). Upon shutdown webmin would be killed violently, but this may not have been a problem and thus no one noticed. The one thing that would have occured is that switching between run levels (say 3 to 5 for instance) would have webmin stop and then restarted (which I do believe I have observed). Concerning chkconfig, I can see why for your purposes you may want to avoid chkconfig. You want the RPM to install on as many machines as possible. Still you probably don't want to have the links be part of the files that ship with the RPM. The reason is that those links are subject to change by the user (their kind of like config information). I would make their creatoin part of your post script and their deletion part of your of your preun (I would do this in the preun, because you need to be able to trace the links back to the correct rc script...that is verify that they link to your webmin rc script). Also, and you may not want to go this far, I would set the post script and pre-un script to use chkconfig if it exists. The reason I say this is that, chkconfig on a RedHat derivative system (RedHat, Mandrake, and friends) will handle the placement of these sym links automatically, and provide entries in some database (I am not sure where it lives) for ntsysv and friends. Its just the right thing to do on a RedHat based system. On the other hand that makes your code more complicated. Cheers...james - Jamie |
From: Jamie C. <jca...@we...> - 2002-08-28 14:13:20
|
jam...@te... wrote .. > > > > This is one of those simple things that I rarely dig into though. > It > > > just works, so why bother understanding it? ;-) > > > > > > Anyway, in my RPMs I've gone under the assumption that you start it > in > > > runlevels where you want it to run and kill it in levels where you > don't > > > (thus network gets killed in level 1..actually everything gets killed > > > there except S00single). I may be wrong, but it seems to work. Then > > > again, so does Webmin! ;-) > > > > Looks like you are right .. all the other init scripts on my system have > > their S links in rc3.d, rc4.d and rc5.d , and their K links in rc0.d > , > rc1.d > > and rc6.d . So I'll make the Webmin RPM do the same thing .. > > You know it must have worked before because of the order in which the kill > scripts > are called. As in the /etc/rc.d/rc script you have the following comments: > > # First, run the KILL scripts. > . > . > . > # Now run the START scripts. > > So it was bascially killing webmin (though it was not there to be killed), > and then restarting it (or really starting it for the first time). Upon > shutdown webmin would be killed violently, but this may not have been a > problem and thus no one noticed. The one thing that would have occured > is > that > switching between run levels (say 3 to 5 for instance) would have webmin > stop and then restarted (which I do believe I have observed). Yeah, that's probably what happened. If I moved the K scripts to just runlevels 0, 1 and 6 would that cause it to attempt to be re-started when switching from runlevel 3 to 5 ? > Concerning chkconfig, I can see why for your purposes you may want to avoid > chkconfig. You want the RPM to install on as many machines as possible. > Still you probably don't want to have the links be part of the files that > ship > with the RPM. The reason is that those links are subject to change by > the > user (their kind of like config information). I would make their creatoin > part of your post script and their deletion part of your of your preun They could also be marked as config files in the .spec file I guess .. > (I > would > do this in the preun, because you need to be able to trace the links back > to the correct rc script...that is verify that they link to your webmin > rc script). Also, and you may not want to go this far, I would set the > post > script and pre-un script to use chkconfig if it exists. The reason I say > this is that, chkconfig on a RedHat derivative system (RedHat, Mandrake, > and friends) will handle the placement of these sym links automatically, > and > provide entries in some database (I am not sure where it lives) for ntsysv > and friends. Its just the right thing to do on a RedHat based system. > On the other hand that makes your code more complicated. I did consider having the script and links created by a post script, similar to code that is run when installing the .tar.gz version of webmin. This would be good for distros like suse that used /sbin as the init script base directory instead of /etc/init.d ! The only problem would be dealing with the situation in which users were upgrading from an old RPM that had the init scripts as part of the package. It should be possible to deal with though, so I will look into doing that in future .. - Jamie |
From: <jam...@te...> - 2002-08-28 14:49:52
|
jam...@te... wrote .. > Yeah, that's probably what happened. If I moved the K scripts to just > runlevels 0, 1 and 6 would that cause it to attempt to be re-started when > switching from runlevel 3 to 5 ? It should not provided you are creating a subsys file. And you are (you call it a lockfile, but who cares (-;). The code /etc/rc.d/rc actually uses that file to determine if it should try to start a "sub system"/rc script or not. So for instance, it would work like this: 1) Go to run level 3. 2) See if webmin subsys file exists. 3) It does not so start it. 4) webmin rc script creates the subsys file. 5) Go to run level 5. 6) See if webmin subsys file exists. 7) It does so don't run the webmin rc script. > > Concerning chkconfig, I can see why for your purposes you may want to avoid > > chkconfig. You want the RPM to install on as many machines as possible. > > Still you probably don't want to have the links be part of the files that > > ship > > with the RPM. The reason is that those links are subject to change by > > the > > user (their kind of like config information). I would make their creatoin > > part of your post script and their deletion part of your of your preun > > They could also be marked as config files in the .spec file I guess .. I suppose you could do that. Some rpms take this approach, and you end up with symblinks called S??*.rpmsave hanging around. <SNIP> > > provide entries in some database (I am not sure where it lives) for ntsysv > > and friends. Its just the right thing to do on a RedHat based system. > > On the other hand that makes your code more complicated. > > I did consider having the script and links created by a post script, similar to > code that is run when installing the .tar.gz version of webmin. This would > be good for distros like suse that used /sbin as the init script base > directory instead of /etc/init.d ! You HP/UX places there rc scripts under /sbin also. Very scary. That was the one thing about HP/UX I always scratched my head over. Cheers...james |
From: Jamie C. <jca...@we...> - 2002-08-29 01:32:04
|
jam...@te... wrote: > jam...@te... wrote .. > > >>Yeah, that's probably what happened. If I moved the K scripts to just >>runlevels 0, 1 and 6 would that cause it to attempt to be re-started when >>switching from runlevel 3 to 5 ? >> > > It should not provided you are creating a subsys file. And you are (you > call it a lockfile, but who cares (-;). The code /etc/rc.d/rc actually > uses that file to determine if it should try to start a "sub system"/rc > script or not. So for instance, it would work like this: > > 1) Go to run level 3. > 2) See if webmin subsys file exists. > 3) It does not so start it. > 4) webmin rc script creates the subsys file. > 5) Go to run level 5. > 6) See if webmin subsys file exists. > 7) It does so don't run the webmin rc script. Yeah, webmin creates a subsys file on redhat. Glad to hear it is good for something .. >>>Concerning chkconfig, I can see why for your purposes you may want to >>> > avoid > >>>chkconfig. You want the RPM to install on as many machines as >>> > possible. > >>>Still you probably don't want to have the links be part of the files >>> > that > >>>ship >>>with the RPM. The reason is that those links are subject to change by >>>the >>>user (their kind of like config information). I would make their >>> > creatoin > >>>part of your post script and their deletion part of your of your preun >>> >>They could also be marked as config files in the .spec file I guess .. >> > I suppose you could do that. Some rpms take this approach, and you end up > with symblinks called S??*.rpmsave hanging around. Good point .. that wouldn't be a good idea then. >>>provide entries in some database (I am not sure where it lives) for >>> > ntsysv > >>>and friends. Its just the right thing to do on a RedHat based system. >>>On the other hand that makes your code more complicated. >>> >>I did consider having the script and links created by a post script, >> > similar to > >>code that is run when installing the .tar.gz version of webmin. This >> > would > >>be good for distros like suse that used /sbin as the init script base >>directory instead of /etc/init.d ! >> > You HP/UX places there rc scripts under /sbin also. Very scary. That was > the one thing about HP/UX I always scratched my head over. Fortunately I don't have to worry about installing RPMs on HP/UX though :) - Jamie |