Date

I've just spent a rather dry afternoon working out how to create a service on AIX. In brief, AIX doesn't provide any real support for SysV style Unix services, instead it has its own scheme, which does not use the familiar start/stop wrapper scripts.

To make a new service:

mkssys -s NAME -p PATH -u UID -S -n15 -f9 -a 'COMMAND ARGS'

This makes a new signal-controlled (-S) service, named NAME. The executable to run is PATH, and it is passed COMMAND ARGS at start-up. Signal 15 (TERM) is used for normal shut-down and 9 (KILL) for forced shutdown - I'm not sure why these aren't the default.

To start the service:

startsrc -s NAME

To stop the service:

stopsrc -s NAME

To delete the service:

rmssys -s NAME

All in all, it's quite nice and simple.

To automatically start the service at boot-time

Add a line like this to /etc/inittab:

NAME:23456789:respawn:/usr/bin/startsrc -s NAME

Make sure that the first NAME is unique in the file - it doesn't actually need to be the same as your service name. 'respawn' means that init will try to restart your service if it fails. You can use 'once' instead of 'respawn', if you don't want init to keep starting it up after it's failed.