Solaris SMF to Upstart on RHEL6
I am planning a migration from Solaris/x86 to RHEL6. Part of this migration will be migrating services from SMF to the RHEL6 equivalent, which appears to be upstart. While init.d scripts still seem to be supported, I want to take advantage of a more sophisticated init daemon, especially for features like job supervision (restarting etc). I would like to gather some thoughts on a few points:
1) Is upstart an adequate job supervisor, i.e. does it preclude the need for stand-alone managers like daemontools/supervise?
2) Upstart scripts seem very bare-bones compared to a typical init.d script. If I was porting an init.d script to Upstart, is it OK to just "exec /etc/init.d/myjob start"? This include RHEL installed programs like httpd.
3) Does upstart do anything is regards to pid files, and what are it's expectations in regards to the forking model of the process?
4) Are there any straightforward guides to the process management aspect of Upstart...and by that I mean the conditions around controlling restarting? e.g. how many times to restart the process before it goes into a maintenance state, or to ignore errors/core dumps in child processes of the supervised process.
Any other relevant ideas or guides would be appreciated.
TIA
Solution 1:
Don't bother with using any of the "advanced" features of upstart on RHEL6. It only uses upstart as a "replacement" for the original SysVinit, and only uses old-style init scripts. RHEL itself doesn't take advantage of any new upstart features, and RHEL7 does not include upstart. In fact upstart has pretty much been abandoned by everyone at this point except Ubuntu (only because they invented it) and Debian. RHEL7 uses systemd, which many other modern Linux distributions now use, and Debian is in the midst of switching.
To future-proof your script, write a "normal" init-script; these are also supported in systemd for backward compatibility, though unlike upstart in RHEL6, systemd's new features actually are used in RHEL7. A number of tutorials are available on the Internet for writing SysVinit scripts; one very good one is provided by the Fedora Project. When you move to RHEL7, you can switch to a systemd unit file if you like.