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.
/etc/rc.d/rc2
for samples. – Lorinczy Zsigmond Jan 22 '20 at 11:51/etc/rc.d/init.d/homemade start
and/etc/rc.d/init.d/homemade stop
. These would work in other Unix versions, too. – Lorinczy Zsigmond Jan 22 '20 at 12:58