diff options
author | Daniel Joseph Barnhart Clark <dclark@pobox.com> | 2007-02-25 15:58:21 +0000 |
---|---|---|
committer | Daniel Joseph Barnhart Clark <dclark@pobox.com> | 2007-02-25 15:58:21 +0000 |
commit | c57b749af348f76b30c20774444ed48b200a1f2e (patch) | |
tree | 046e7c94cba56f128e1a8c46dbe4e0636507e1db /encap | |
parent | 2984f41369d090210041b865c0b3f7cc5cd67745 (diff) | |
download | bcfg2-c57b749af348f76b30c20774444ed48b200a1f2e.tar.gz bcfg2-c57b749af348f76b30c20774444ed48b200a1f2e.tar.bz2 bcfg2-c57b749af348f76b30c20774444ed48b200a1f2e.zip |
EncapPackages: Updates for runit encap
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2868 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'encap')
-rw-r--r-- | encap/src/encap-profiles/bcfg2-0.9.2.ep | 20 | ||||
-rw-r--r-- | encap/src/encap-profiles/runit-1.7.2.ep | 28 |
2 files changed, 38 insertions, 10 deletions
diff --git a/encap/src/encap-profiles/bcfg2-0.9.2.ep b/encap/src/encap-profiles/bcfg2-0.9.2.ep index c78c59171..b32a799a2 100644 --- a/encap/src/encap-profiles/bcfg2-0.9.2.ep +++ b/encap/src/encap-profiles/bcfg2-0.9.2.ep @@ -394,16 +394,16 @@ if [ "${RUN_INTERVAL_SECONDS}x" = "x" ]; then RUN_INTERVAL_SECONDS=3600 fi -# loop forever -while : -do - printf "*** starting /usr/local/bin/bcfg2 ${OPTIONS} ...\n" - /usr/local/bin/bcfg2 ${OPTIONS} - printf "*** sleeping ${RUN_INTERVAL_SECONDS} seconds ...\n" - sleep ${RUN_INTERVAL_SECONDS} -done - -exit 0 +# Run bcfg2 and then sleep (runsv takes care of starting up script +# again after it exits). Need to exec sleep so runit can exit +# cleanly while the sleep is in progress; see: +# http://comments.gmane.org/gmane.comp.sysutils.supervision.general/1373 +# for more information on why this is required (short reason: runit is +# more anal about making sure things are logged than daemontools) +printf "*** starting /usr/local/bin/bcfg2 ${OPTIONS} ...\n" +/usr/local/bin/bcfg2 ${OPTIONS} +printf "*** sleeping ${RUN_INTERVAL_SECONDS} seconds ...\n" +exec sleep ${RUN_INTERVAL_SECONDS} ]]></include_file> <include_file name="etc/sv/bcfg2-client/run" mode="0755"><![CDATA[ diff --git a/encap/src/encap-profiles/runit-1.7.2.ep b/encap/src/encap-profiles/runit-1.7.2.ep index 7545fa356..7d7e6c245 100644 --- a/encap/src/encap-profiles/runit-1.7.2.ep +++ b/encap/src/encap-profiles/runit-1.7.2.ep @@ -153,6 +153,19 @@ test -d /usr/local/var/service || mkdir /usr/local/var/service test -d /usr/local/etc || mkdir /usr/local/etc test -d /usr/local/etc/default || mkdir /usr/local/etc/default test -d /usr/local/etc/sv || mkdir /usr/local/etc/sv +for service in `ls /usr/local/etc/sv`; do + test -d /usr/local/etc/sv/$service/supervise && rm -rf /usr/local/etc/sv/$service/supervise + test -d /usr/local/etc/sv/$service/log/supervise && rm -rf /usr/local/etc/sv/$service/log/supervise +done +if [ -d /usr/local/var/service/.disabled ]; then + for service in `ls /usr/local/var/service/.disabled`; do + if [ -h /usr/local/var/service/$service ]; then + rm /usr/local/var/service/.disabled/$service + else + mv /usr/local/var/service/.disabled/$service /usr/local/var/service/ + fi + done +fi if [ -f /etc/inittab ]; then printf "Installing to /etc/inittab ...\n" cd ${ENCAP_SOURCE}/${ENCAP_PKGNAME} && ./inittab-install @@ -181,6 +194,21 @@ if [ -d /etc/event.d ]; then rm /etc/event.d/SV fi fi +printf "Test, remove this code soon:\n" +ps auxw | grep sv +test -d /usr/local/var/service/.disabled || mkdir /usr/local/var/service/.disabled +for service in `ls /usr/local/var/service`; do + sv exit /usr/local/var/service/$service +done +printf "Waiting 7 seconds for runsv processes to die...\n" +sleep 7 +mv /usr/local/var/service/* /usr/local/var/service/.disabled/ 2>/dev/null || printf "No services to disable.\n" +printf "Waiting 7 more seconds for runsv processes to die...\n" +sleep 7 +for service in `ls /usr/local/etc/sv`; do + test -d /usr/local/etc/sv/$service/supervise && rm -rf /usr/local/etc/sv/$service/supervise + test -d /usr/local/etc/sv/$service/log/supervise && rm -rf /usr/local/etc/sv/$service/log/supervise +done printf "Finished runit preremove script.\n" ]]></include_file> |