[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to see the output of a custom init script on Lenny?



On Tue, 20 Jan 2009, Sander Marechal wrote:

> Hello,
>
> I have written a simplistic custom init script that makes a backup of my
> entire system using `rsync -vv`. I have symlinked this script as
> /etc/rc0.d/K00backup and /etc/rc6.d/K00backup so that the backup occurs
> whenever I reboot or shut down.
>
> When I was using Etch I would see the output of rsync when I shut down
> my system. Now with Lenny I don;t see the output anymore. From what
> Google tells me this is because under Lenny the init scripts should use
> the lsb functions to output and that all normal output is now hidden.
>
> Making a backup of my system takes some time, hence my use of -vv and
> --progress on rsync so I can see how far it is. I would like to see that
> output when I shut down my system. There does not appear to be an lsb
> init function that I can simply pipe the output of rsync to.
>
> How do I make the rsync output appear when I shut down my system?
>
> Thanks in advance,
>
>

I just tested this out on my Lenny system and it appears to work:

#!/bin/sh

. /lib/lsb/init-functions

DESC="Backup Script"
PATH=/bin:/usr/bin:/sbin:/usr/sbin

stop () {
log_daemon_msg "Starting Backup sync"
log_progress_msg ; rsync -avr --progress /src/ /dest/
log_action_end_msg 0
}
case "$1" in
    stop)
        log_daemon_msg "Running $DESC" "$NAME"
        if stop ; then
                log_end_msg $?
        else
                log_end_msg $?
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {stop}"
        exit 3
        ;;

esac

exit 0

Upon shutdown or reboot, I see the output of rsync .. for more info on
the functions read through /lib/lsb/init-functions

hth
Jeff
-- 
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.


Reply to: