Hi there
@Dhruva
Thank you for your reply; I think I understand what you are explaining to me, and I have added a "sleep 60"
@Blowtorch
Thank you for the information on the backtick. I honestly thought that ` and $() were the same, and as you point out, they do different things which makes it a bit clearer now
Regarding the "ps" command:
Using the flag "-a", I am able to view other users processes as well as mine (and as I am after httpd/Apache, I need this function).
Using the flag "-c", I only get the command that is being run by the user, and not the full path to that command.
Using the flag "-u", means that I get information regarding the users running services, amongst other things.
Using the flag "-x", displays all processess, including those without controlling terminal sessions. I need this one to display the "httpd" process, in this case, run as the user "www".
To be honest, typing "ps -axcu" is force-of-habit every time I wish to view the process list, so that is probably the main reason why it is like that in the script.
I am running "ps" under a BSD flavour (in this case, Mac OS X), so your "ps" might be different. For example, your location for "ps" would appear to be "/usr/ucb/ps", whereas mine is "/bin/ps". Again, "ifconfig" under GNU/Linux flavour Ubuntu, does not contain the options "alias" or "-alias", for, well, aliasing IP's and netmasks to one physical network interface, whereas in the Mac OS X version, it does.
Does that answer your query at all?
This script is one in a series that I am writing at the moment, as IP Failover in OS X is quite limited, in that the heartbeat daemon can not be attached to any services (kind of silly), so the only way the master will failover to the backup server is if the heartbeat fails. In this instace, the heartbeat will only fail if the interfaces that it is sent over, go down. The flaw in this is that a service such as Apache of PostgreSQL can fail, but the interfaces will remain active, and therefore no failover.
Mike