Hi
Firstly there is a new executable which does not allow -h or --help to be used for it called /usr/local/sbin/cups-browsed which is a part of an upgrade for cups and will be a part of a tcz called cups-filters
file /tmp/tcloop/cups-filters/usr/local/sbin/cups-browsed
/tmp/tcloop/cups-filters/usr/local/sbin/cups-browsed: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.22, not stripped
I am concerned with improving the init script and not whether the executable will work (That will require testing with some kind soul with wireless printing)
1) Initially I had a chain of if then, elif , elif else and cli
Here is my current version of script put in a code box for display purposes only, quote gets too small for my eyesight
#!/bin/sh
# we need dbus, cups, avahi, avahi-dnsconfd running before
# starting this service. Ideas taken from avahi init
# and dumbed down to my level. Above is put into info file
# this is only to do cups-browsed
start() {
if [ ! -f /var/run/dbus/avahi_flag ] ; then
/usr/local/etc/init.d/avahi start
else
/usr/local/sbin/avahi-dnsconfd -D
fi
touch /var/run/dbus/cups-browsed_flag
/usr/local/sbin/cups-browsed &
}
stop() {
rm -rf /var/run/dbus/cups-browsed_flag
pkill cups-browsed
pkill avahi-dnsconfd
}
status() {
if pidof cups-browsed > 0 ; then
echo -e "\ncups-browsed is running.\n"
exit 0
else
echo -e "\ncups-browsed is not running.\n"
exit 1
fi
}
case $1 in
start) start
;;
stop) stop
;;
status) status
;;
restart) stop; start
;;
*) echo -e "\n$0 [start|stop|restart|status]\n"
;;
esac
The creation of the flag under /var/run is based on avahi, and might be useful if pidof is not useful but I can't really tell at this stage.
thanks for reading
TODO see if I can get it to see the /usr/local/etc/....config file like cupsd can