elmars.ositis@xxxxxx, Tue, Feb 01, 2005 at 12:01:29PM +0200:
> Before I go spending my time inventing the wheel, I would like to ask
> whether anyone has built an init script around lp5250d to autostart some

The script I use is taken from the classic debian skeleton by Miguel de
Icaza:

------------------------
#!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin
FLAGS="defaults 23"

test -x /usr/bin/lp5250d || exit 0
test -f /etc/default/lp5250d || exit 0

# /etc/default/lp5250d contains the variable part of the startup script, that 
is args to the command:
# lp5250args="host=X.X.X.X map=280 env.DEVNAME=TECPRTPDF 
outputcommand=/usr/local/bin/putpdf"

. /etc/default/lp5250d

case "$1" in
        start)
                echo -n "Starting AS/400 PDF print server: lp5250d"
                start-stop-daemon --start --quiet --name lp5250d --exec 
/usr/bin/lp5250d -- "$lp5250args"

                echo "."
                ;;
        stop)
                echo -n "Stopping AS/400 PDF print server: lp5250d"
                start-stop-daemon --stop --quiet --name lp5250d --exec 
/usr/bin/lp5250d
                echo "."
                ;;
        restart|force-reload)
                echo -n "Restarting AS/400 PDF print server: lp5250d... "
                start-stop-daemon --stop --quiet --pidfile /var/run/lp5250.pid
                sleep 2
                start-stop-daemon --start --quiet --name lp5250d --exec 
/usr/bin/lp5250d -- "$lp5250args"
                echo "done."
                ;;
        *)
                echo "Usage: /etc/init.d/lp5250d 
{start|stop|restart|force-reload}"
                exit 1
                ;;
esac

exit 0
------------------------

Actually, there is a second version to autostart more than one lp5250d printer,
but it's in an unfinished state somewhere on my archives...

<light flame>
I strongly disapprove the use of daemontools as they are:
1) not DFSG-compliant (distribution in binary form is forbidden)
2) contrary to the UNIX philosophy as they handle startup/shutdown AND
   monitoring. I prefer use a script to start/stop a daemon, and a monitor
   application to monitor its state and take necessary action on state change.
   If I wanted Windows' service manager I would have installed it.
</light flame>

-- 
pbm - "But something happened - don't know if I can explain it
       just call me the man whose heart turned to stone"

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].