AIX and daemon service

aixdaemoninitstart-stop-daemonsysvinit

I see that the daemon service is started and stopped via the commands:

startsrc and stopsrc on group/subsystem.

I have init.d script and I want to make it daemon service in AIX.
From these commands I think I have to put the init.d script into a group
and then the starting and stopping of the service will be done by
the commands "startsrc" and "stopsrc" executed on the group/subsystem.But how can I put the init.d script into a group/subsystem?

Best Answer

I have init.d script

Don't start from there, especially if it came from a non-AIX system. This is almost certainly rubbish that will lead you up the garden path.

Just plonking an rc script under the service manager is a sin that people commit on Linux operating systems using systemd, but it has been a sin for a long time, especially on AIX, which has had proper service management since 1990.

Use the mkssys command to define your subsystem, which you can then start and stop as you said with startsrc and stopsrc. Use the rmssys to remove it if you ever want to do that. Use the -s option to all of these with a unique name for your subsystem.

You more probably than not want -S with mkssys, and -R. Just work out the command path and arguments for your dæmon process, and the user ID it is to run as, and employ the -p, -a, -u options appropriately.

Your rc script will give you a clue as to the command path and arguments, but that will probably be buried under a heap of shell variables and stuff. That's probably the only information in the rc script that will be useful to you.

Related Question