Q: how to start a service when system start

As topic, assume we have a service called "blahservice"

and we can start it by:

startsrc -s blahservice

what is the best practice to run such command when system start?

  • directly use mkitab to add it into /etc/inittab

or

  • drop startup scripts in /etc/rc.d/rcX.d

I know they are all possible ways, but I am really keen to know which is the AIX native way and why, pros and cons will be appreciated.

Thanks in advance.

Edit:

I am targeting for AIX 5.2, 5.3 and 6.1

Use mkitab.

It's recommended and 'ibm best practice'. You can precisely set runlevel, chose after what services it starts.

I agree with borek,

services should be started via inittab, where you can detail the runlevel, you want it to start, if it should respawn or only be started once and similar things - all scripts are started in runlevel-order and within the runlevel regarding the order in inittab

applications should be started via /etc/rc.d/rc2d/S** or manually just out of /etc/rc.d/init.d

Rgds
zxmaus

Most subsystems that use the system resource controller are started from /etc/rc.tcpip.

Regarding of running script on system startup, what would be the best practice to run script under non-root privilege?

I tried to start Oracle on system startup as oracle user. I put:

su - oracle

after shebang (#!/bin/sh) line, but I had no luck :frowning:

Also, do you know where to check log file of system startup script? Thanks :slight_smile: