Hi Kazunori, it´s fine to support upstart as a concept, but can we please use the same integration as for sysvinit and systemd by making it optional? Otherwise i don´t see any problem to merge it. Fabio On 3/15/2013 8:55 AM, Kazunori INOUE wrote: > Hi, > > I wrote Upstart job (configuration file) of corosync service and > corosync-notifyd service. > > I'm using Corosync in combination with Pacemaker in RHEL6, and am > going to manage Pacemaker by Upstart. > (ML of related Pacemaker: > http://www.gossamer-threads.com/lists/linuxha/pacemaker/84141#84141) > Therefore I intend to use it in job of pacemaker ("pacemaker-corosync") > if there are job "corosync" and "corosync-notifyd". I think that > "respawn" stanza specified in "corosync-notifyd" is especially useful. > > ---- > corosync.spec.in | 2 + > init/Makefile.am | 9 ++++-- > init/corosync-notifyd.conf.in | 38 ++++++++++++++++++++++++++++++ > init/corosync.conf.in | 52 +++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 98 insertions(+), 3 deletions(-) > > diff --git a/corosync.spec.in b/corosync.spec.in > index b262f2c..0a1b3df 100644 > --- a/corosync.spec.in > +++ b/corosync.spec.in > @@ -197,6 +197,8 @@ fi > %{_initrddir}/corosync > %{_initrddir}/corosync-notifyd > %endif > +%{_sysconfdir}/init/corosync.conf > +%{_sysconfdir}/init/corosync-notifyd.conf > %dir %{_localstatedir}/lib/corosync > %dir %{_localstatedir}/log/cluster > %{_mandir}/man8/corosync_overview.8* > diff --git a/init/Makefile.am b/init/Makefile.am > index 804ad7c..e64d1ff 100644 > --- a/init/Makefile.am > +++ b/init/Makefile.am > @@ -34,7 +34,7 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -EXTRA_DIST = corosync.in corosync-notifyd.in corosync.service.in corosync-notifyd.service.in > +EXTRA_DIST = corosync.in corosync-notifyd.in corosync.service.in corosync-notifyd.service.in corosync.conf.in corosync-notifyd.conf.in > > if INSTALL_SYSTEMD > systemdconfdir = $(SYSTEMDDIR) > @@ -45,6 +45,9 @@ initscriptdir = $(INITDDIR) > endif > initscript_SCRIPTS = corosync corosync-notifyd > > +upstartconfdir = $(sysconfdir)/init > +upstartconf_DATA = corosync.conf corosync-notifyd.conf > + > %: %.in Makefile > rm -f $@-t $@ > cat $< | sed \ > @@ -57,7 +60,7 @@ initscript_SCRIPTS = corosync corosync-notifyd > > $@-t > mv $@-t $@ > > -all-local: $(initscript_SCRIPTS) $(systemdconf_DATA) > +all-local: $(initscript_SCRIPTS) $(systemdconf_DATA) $(upstartconf_DATA) > > clean-local: > - rm -rf $(initscript_SCRIPTS) $(systemdconf_DATA) > + rm -rf $(initscript_SCRIPTS) $(systemdconf_DATA) $(upstartconf_DATA) > diff --git a/init/corosync-notifyd.conf.in b/init/corosync-notifyd.conf.in > new file mode 100644 > index 0000000..b1ac70c > --- /dev/null > +++ b/init/corosync-notifyd.conf.in > @@ -0,0 +1,38 @@ > +# corosync-notifyd - Corosync Dbus and snmp notifier > +# > +# Starts corosync-notifyd > + > +expect fork > +respawn > + > +env prog=corosync-notifyd > +env rpm_sysconf=@SYSCONFDIR@/sysconfig/corosync-notifyd > +env rpm_lockfile=@LOCALSTATEDIR@/lock/subsys/corosync-notifyd > +env deb_sysconf=@SYSCONFDIR@/default/corosync-notifyd > +env deb_lockfile=@LOCALSTATEDIR@/lock/corosync-notifyd > + > +script > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + exec $prog $OPTIONS > +end script > + > +pre-start script > + mkdir -p @LOCALSTATEDIR@/run > +end script > + > +post-start script > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/sysconfig ] && LOCK_FILE="$rpm_lockfile" > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/default ] && LOCK_FILE="$deb_lockfile" > + touch $LOCK_FILE > +end script > + > +post-stop script > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/sysconfig ] && LOCK_FILE="$rpm_lockfile" > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/default ] && LOCK_FILE="$deb_lockfile" > + rm -f $LOCK_FILE > +end script > diff --git a/init/corosync.conf.in b/init/corosync.conf.in > new file mode 100644 > index 0000000..a0243f9 > --- /dev/null > +++ b/init/corosync.conf.in > @@ -0,0 +1,52 @@ > +# corosync - Corosync Cluster Engine > +# > +# Starts corosync > + > +expect fork > + > +env prog=corosync > +env rpm_sysconf=@SYSCONFDIR@/sysconfig/corosync > +env rpm_lockfile=@LOCALSTATEDIR@/lock/subsys/corosync > +env deb_sysconf=@SYSCONFDIR@/default/corosync > +env deb_lockfile=@LOCALSTATEDIR@/lock/corosync > + > +script > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + exec $prog > +end script > + > +pre-start script > + mkdir -p @LOCALSTATEDIR@/run > +end script > + > +post-start script > +wait_for_ipc() > +{ > + try=0 > + while [ "$try" -le "20" ]; do > + if corosync-cfgtool -s > /dev/null 2>&1; then > + return 0 > + fi > + sleep 0.5 > + try=$((try + 1)) > + done > + logger -i -t "$UPSTART_JOB" "ERROR: Any interfaces are faulty!" > + return 1 > +} > + wait_for_ipc || { stop; exit 1; } > + > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/sysconfig ] && LOCK_FILE="$rpm_lockfile" > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/default ] && LOCK_FILE="$deb_lockfile" > + touch $LOCK_FILE > +end script > + > +post-stop script > + [ -f "$rpm_sysconf" ] && . $rpm_sysconf > + [ -f "$deb_sysconf" ] && . $deb_sysconf > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/sysconfig ] && LOCK_FILE="$rpm_lockfile" > + [ -z "$LOCK_FILE" -a -d @SYSCONFDIR@/default ] && LOCK_FILE="$deb_lockfile" > + rm -f $LOCK_FILE > +end script > ---- > Best regards, > Kazunori INOUE > _______________________________________________ > discuss mailing list > discuss@xxxxxxxxxxxx > http://lists.corosync.org/mailman/listinfo/discuss > _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss