Bug#170677: ITP: launchtool -- Run a command supervising its execution

2002-11-25 Thread Enrico Zini
Package: wnpp
Version: unavailable; reported 2002-11-25
Severity: wishlist

* Package name: launchtool
  Version : 0.6
  Upstream Author : Enrico Zini [EMAIL PROTECTED]
* URL : http://people.debian.org/~enrico/launchtool.html
* License : GPL
  Description : Run a command supervising its execution

Run a user-supplied command supervising its execution in many ways,
such as controlling its environment, blocking signals, logging its
output, changing user and group permissions, limiting resource usage,
restarting it if it fails, running it continuously, turning it into
a daemon and more.



Bye, Enrico






Re: Bug#170677: ITP: launchtool -- Run a command supervising its execution

2002-11-25 Thread Christian Surchi
On Mon, Nov 25, 2002 at 03:16:20PM +0100, Enrico Zini wrote:
 * Package name: launchtool
... 
 Run a user-supplied command supervising its execution in many ways,
 such as controlling its environment, blocking signals, logging its
 output, changing user and group permissions, limiting resource usage,
 restarting it if it fails, running it continuously, turning it into
 a daemon and more.

So, is it different from the *simple* daemon the we have already in
the archive? And maybe it's not a PITA like run! ;-)

-- 
Christian Surchi, [EMAIL PROTECTED], [EMAIL PROTECTED] |   ICQ 
www.debian.org - www.softwarelibero.it - www.firenze.linux.it| 38374818
But, officer, he's not drunk, I just saw his fingers twitch!




Re: Bug#170677: ITP: launchtool -- Run a command supervising its execution

2002-11-25 Thread Enrico Zini
On Mon, Nov 25, 2002 at 03:45:53PM +0100, Christian Surchi wrote:

  * Package name: launchtool
  Run a user-supplied command supervising its execution in many ways,
  such as controlling its environment, blocking signals, logging its
  output, changing user and group permissions, limiting resource usage,
  restarting it if it fails, running it continuously, turning it into
  a daemon and more.
 
 So, is it different from the *simple* daemon the we have already in
 the archive? And maybe it's not a PITA like run! ;-)

It's quite similar to daemon.  They have similar features, some are
better in daemon, some are better in launchtool.  It has features
similar to start-stop-daemon, as well.  It can probably replace both, or
be replaced by one of them in most situations.

However, launchtool is not intended to only run daemons: you can run a
shellscript normally, but with its output sent to the logs with the
given priority, for example.

You can also create an executable configuration file for launchtool and
use it as a wrapper around another command.

I include some examples taken from the manpage, to give an idea of how
it works and of some intended scenarions of usage:

# Run a command normally
launchtool -t tag 'echo Hello, world!'

# Run a command restarting it if it fails:
launchtool -t tag --wait-times=1,1,1,3,3,3,10,10,10 'my_wonderful_server'

# Run a command, with restrictions, restarting it if it fails, as a
# daemon
launchtool -t myserver -d --user=myserver --chroot=/var/myserver \
--limit-process-count=5 --limit-open-files=10 \
--wait-times=1,1,1,3,3,3,10,10,10 \
--infinite-runs --stats \
--log-launchtool-output=syslog:myserver,LOG_DAEMON,LOG_INFO \
--log-launchtool-errors=syslog:myserver,LOG_DAEMON,LOG_ERR \
--log-child-output=syslog:myserver,LOG_DAEMON,LOG_INFO \
--log-child-errors=syslog:myserver,LOG_DAEMON,LOG_ERR \
'my_experimental_server'

# Same thing, using a configuration file
tag = myserver
command = my_wonderful_server
daemon = yes
stats = yes
user = myserver
root dir = /var/myserver
process count limit = 5
open files limit = 10
wait times = 1,1,1,3,3,3,10,10,10
infinite runs = yes
launchtool output = syslog:myserver,LOG_DAEMON,LOG_INFO
launchtool errors = syslog:myserver,LOG_DAEMON,LOG_ERR
command output = syslog:myserver,LOG_DAEMON,LOG_INFO
command errors = syslog:myserver,LOG_DAEMON,LOG_ERR 

# Transform a shell command in a polling daemon that ensures that the
# file /tmp/have_mobile exists only if my cell phone is present in the
# IRDA discovery list
launchtool -t celldetect -d --silent-restart-time=5 --silent-restart-status=0 
--user=nobody \
if grep -q SIEMENS /proc/sys/net/irda/discovery; then touch 
/tmp/have_mobile; else rm -f
/tmp/have_mobile; fi ; exit 0

# Ceck if the celldetect daemon is running
launchtool -t celldetect --check

# Kill the celldetect daemon launched with the command above
launchtool -t celldetect -k

# Same polling daemon, with an executable configuration file

#!/usr/bin/launchtool -C
tag = celldetect
command = if grep -q SIEMENS /proc/sys/net/irda/discovery; then touch 
/tmp/have_mobile; else rm -f /tmp/have_mobile; fi ; exit 0
daemon = yes
user = nobody
silent restart time = 5
silent restart status = 0

# Check if the celldetect daemon is running, using the executable
# configuration file
celldetect --check

# Kill the celldetect daemon using the executable configuration file
celldetect -k


And, no, it does not intend to be a PITA like run. :-)

Bye, Enrico