Suresh Ramasubramanian wrote: > look at the shutdown scripts ... and if you have a system where ctrl alt del > by even a user will reboot the box, goodbye ;) > >
Hmm now I wonder whether the two debian machines I shutdown once in a bluemoon recognizes me as the superuser even without me login in ;) - the redhat ones are dumb no doubt :-). Ok back to the answer: Most systems would switch to run level 6 when contrl-alt-del is pressed on the console. Now what happens in each run level is controlled by a set of scripts. Most distros keep the scripts in separate directories one for each run level. Redhat keeps them in /etc/rc.d/rc<run level>.d/ Debian keeps them in /etc/rc<run level>.d/ Now since there are usually 6 run levels by default in most distros it would become cumbersome to maintain 6 copies of the same script and then one set for startup and one set for shutdown, what most distros do is symlink from one init.d directory to each run level. In RedHat this is /etc/rc.d/init.d/ and Debian it is /etc/init.d/. Next the scripts in init.d usually need a parameter to be passed which tells them whether the service it is providing needs to started or shutdown. Unfortunately this is not mandatory and usually for home made scripts not applicable either. More specifically almost no distro gives you a option for the localized scripts to be aware of a startup or shutdown situation. They just assume the local scripts just need to start and not end or can safely handle a sigterm or maybe the service they provide is needed only during startup. You would note the difference when you go through the scripts. All of them other than init.d/local or rc.local would be able to handle a stop and start parameter. You could basically do two things one enhance your version of local to be able to handle start and stop and then symlink it from runlevel 6. Or what seems more appropriate to me is that since it is a service which could possible be up for the whole session I would suggest you explore the init scripts and create one for your service. Mithun _______________________________________________ linux-india-help mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/linux-india-help
