From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1976 Path: news.gmane.org!not-for-mail From: Laurent Bercot Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Configuration services Date: Sun, 26 Jul 2009 19:07:35 +0200 Message-ID: <20090726170735.GA13244@skarnet.org> References: <20090726162204.GA19230@pretender.frop.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248627985 2327 80.91.229.12 (26 Jul 2009 17:06:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Jul 2009 17:06:25 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-2211-gcsg-supervision=m.gmane.org@list.skarnet.org Sun Jul 26 19:06:18 2009 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1MV7Av-0002vD-RV for gcsg-supervision@gmane.org; Sun, 26 Jul 2009 19:06:17 +0200 Original-Received: (qmail 18138 invoked by uid 76); 26 Jul 2009 17:07:35 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 18130 invoked by uid 1000); 26 Jul 2009 17:07:35 -0000 Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <20090726162204.GA19230@pretender.frop.net> User-Agent: Mutt/1.4i Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1976 Archived-At: > Hi, does anyone use services that just set up some things but don't actually run a daemon? This is hinted at http://smarden.org/pape/djb/daemontools/noinit.html. > > Solaris does things like this with their SMF system and what they call "checkpoints". > > I am doing this with runit by putting a while ./check; do; sleep 300; done; loop in the run script. Is there a better way? You can get rid of the shell for the 5 minutes of sleeping by letting runit perform the loop itself. Your run script could look like: #!/bin/sh ./check exec sleep 300 or even better: #!/command/execlineb -P foreground { ./check } sleep 300 When sleep exits, the run script terminates, and runsv will automatically start it again. No need for a loop inside your script. No need to keep the shell around while the only thing to do is sleep. Additionally, you can decide to perform a ./check *now*, by sending a SIGTERM to the service. (sv term) Bear in mind that all this is valid because you actually want to perform an action regularly, which fits into the "service" model. (But if you are using a crontab-like service on your system, you could also run your regular check as a cron job or equivalent, and spare a service.) If you just want to set up some stuff *once*, and run no daemon, the service model doesn't apply; write a script that does what you want and just call it when needed (for instance at one-time system initialization), don't try to keep it supervised. -- Laurent