views:

212

answers:

2

Hi,

I am creating a linux service , in the skeleton file it is mentioned that we need to run various rc commands(rc-status ,rc_reset) to update the service status. What does this actually mean. I have googled it but not able find many details. Can somebody help me

A: 

You need a shell script to stop/start/restart your service and to give its status. These are generally called rc scripts. Have a look in directory /etc/init.d to see some examples - /etc/init.d/klogd is quite a simple one.

The reason they are in init.d is because they also need to be run automatically at boot up to restore the service.

Each Linux variant tends to be a bit different on how the boot up works but the Debian system is fairly typical as it is the basis for many other distributions - see Debian Boot Up Manager

Dipstick
+1  A: 

The commands from rc.status are actually SuSe specific I think. AFAICT they handle two things: output to the user and the final return status of the script. rc_status checks if the previous command (i.e. the start/restart/stop of a service) executed successfully and sets the "status value", which is the return value returned by rc_exit (which you place at the end of your init.d script). Source

You can conceivably write your shell script without them, but I assume they help making sure that your script conforms to LSB requirements and blends in well with other system scripts. I bet most of this is actually documented in the /etc/rc.status file, though. I just don't have a suse box handy.

wds