FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-20-2009, 09:33 AM
Sander Marechal
 
Default How to see the output of a custom init script on Lenny?

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,

--
Sander Marechal


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 08:21 PM
Sander Marechal
 
Default How to see the output of a custom init script on Lenny?

Is there nobody who knows how to show the stdout ouput of an init script
during shutdown?

Kind regards,

--
Sander Marechal


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 08:58 PM
"Andrew McGlashan"
 
Default How to see the output of a custom init script on Lenny?

Hi,

Sander Marechal wrote:

Is there nobody who knows how to show the stdout ouput of an init
script during shutdown?


Could you perhaps "tee" the output to /dev/console or /dev/tty ?

Kind Regards
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 09:20 PM
Ken Irving
 
Default How to see the output of a custom init script on Lenny?

On Wed, Jan 21, 2009 at 10:21:55PM +0100, Sander Marechal wrote:
> Is there nobody who knows how to show the stdout ouput of an init script
> during shutdown?

My guess is that the answer is "no".

Output should just show up on the console after you initiate shutdown
from there. Until the console itself goes away I don't see why output
from an init script would be handled differently from any other script.
Or perhaps you're assuming (but not stating) some other factors that
might have bearing on your question. If you're not able to see it
on the console, and given that it's a custom script, perhaps you could
write output to some non-volatile location and look at it later.

Ken

--
Ken Irving


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-21-2009, 10:37 PM
Jeff D
 
Default 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.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2009, 07:12 AM
Sander Marechal
 
Default How to see the output of a custom init script on Lenny?

Jeff D wrote:
> I just tested this out on my Lenny system and it appears to work:

Thanks. I tested your script on my system but nothing appears on the
screen at all. When I shut down or reboot, the only thing I see on the
console is:

---
Shutting down, please wait
---

or:

---
Restarting, please wait
---

I don't see anything after that. Neither the rsync output nor the output
I expect from all of Debian's own init scripts. The only thing that
shows right before the system shuts down or reboots is the message that
acpid exited. Nothing else.

So, perhaps this hasn't got anything to do with my custom init script
but with my init system as a whole? My previous Lenny machine did show
messages when shutting down. This one does not.

--
Sander


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2009, 07:16 AM
Sander Marechal
 
Default How to see the output of a custom init script on Lenny?

Ken Irving wrote:
> On Wed, Jan 21, 2009 at 10:21:55PM +0100, Sander Marechal wrote:
>> Is there nobody who knows how to show the stdout ouput of an init script
>> during shutdown?
>
> My guess is that the answer is "no".
>
> Output should just show up on the console after you initiate shutdown
> from there. Until the console itself goes away I don't see why output
> from an init script would be handled differently from any other script.
> Or perhaps you're assuming (but not stating) some other factors that
> might have bearing on your question.

I am starting to think that this has nothing to do with my custom init
script but with my system as a whole. I don't see *any* output when I
shot down or reboot. Only the red "Shutting down, please wait" message,
but nothing after that. If I remove my custom init script then still no
output of any of Debian's own init script is shown.

Any ideas?

--
Sander Marechal


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2009, 08:31 AM
Ken Irving
 
Default How to see the output of a custom init script on Lenny?

On Thu, Jan 22, 2009 at 09:16:01AM +0100, Sander Marechal wrote:
> Ken Irving wrote:
> > On Wed, Jan 21, 2009 at 10:21:55PM +0100, Sander Marechal wrote:
> >> Is there nobody who knows how to show the stdout ouput of an init script
> >> during shutdown?
> >
> > My guess is that the answer is "no".
> >
> > Output should just show up on the console after you initiate shutdown
> > from there. Until the console itself goes away I don't see why output
> > from an init script would be handled differently from any other script.
> > Or perhaps you're assuming (but not stating) some other factors that
> > might have bearing on your question.
>
> I am starting to think that this has nothing to do with my custom init
> script but with my system as a whole. I don't see *any* output when I
> shot down or reboot. Only the red "Shutting down, please wait" message,
> but nothing after that. If I remove my custom init script then still no
> output of any of Debian's own init script is shown.
>
> Any ideas?

A red message? I missed the earlier part of the thread so don't know
what you're dealing with, but I suspect you must be in a gui environment,
and telling the system to shut down via a mouse click or something.

The obvious problem with messages during shutdown is that, however they're
shown, that medium is going to vanish, so you can't sit there and browse
them ala dmesg after the system's turned off.

The obvious solution is to tell your script to write those messages somewhere
that will survive shutdown and startup, e.g., your home directory, /var/tmp/,
etc. (well, /etc/ wouldn't be a great choice ;-). Don't use /tmp/ as that's
cleaned out by default on startup (I think; could be shutdown, maybe).

If you turn off your gui environment and shutdown from a console, e.g.,
hit Alt-F1 to go to tty1, then enter "sudo shutdown -h now" or similar,
then I would think you'd see some messages there.

Ken

--
Ken Irving


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2009, 12:48 PM
Sander Marechal
 
Default How to see the output of a custom init script on Lenny?

Ken Irving wrote:
> A red message? I missed the earlier part of the thread so don't know
> what you're dealing with, but I suspect you must be in a gui environment,
> and telling the system to shut down via a mouse click or something.

Yes. I am using the standard Debian Deskop task, so that's Gnome without
any bootsplashes.

> The obvious problem with messages during shutdown is that, however they're
> shown, that medium is going to vanish, so you can't sit there and browse
> them ala dmesg after the system's turned off.

I don't need to browse them. I just need to be able to see that the
rsync I run on shutdown or reboot is progressing or if it has stalled.
It could output smiley faces for all I care, as long as I see something
happening. I don't want to stare at a blank screen for 10 minutes and
wonder whether the backup has stalled or my girlfriend has simply been
downloading a bunch of large ISO images again.

> If you turn off your gui environment and shutdown from a console, e.g.,
> hit Alt-F1 to go to tty1, then enter "sudo shutdown -h now" or similar,
> then I would think you'd see some messages there.

Yes, then I see the messages. But I used to see those messages too when
I simply clicked "System -> Shutdown" in Gnome. I don't have any kind of
bootsplash. When I shutdown through Gnome I get a terminal in front of
me with:

---
System is shutting down, please wait...
---

After that should appear messages like "shutting down gdm", "stopping
alsa", "unmounting network filesystems", etcetera, etcetera. All the
things that the init.d scripts say. They showed both in Etch and on my
previous Lenny machine, but on this new Lenny system they don't show.

I hope I've explained it better now.

--
Sander Marechal


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2009, 02:05 PM
Daniel Burrows
 
Default How to see the output of a custom init script on Lenny?

On Thu, Jan 22, 2009 at 02:48:16PM +0100, Sander Marechal <s.marechal@jejik.com> was heard to say:
> > If you turn off your gui environment and shutdown from a console, e.g.,
> > hit Alt-F1 to go to tty1, then enter "sudo shutdown -h now" or similar,
> > then I would think you'd see some messages there.
>
> Yes, then I see the messages. But I used to see those messages too when
> I simply clicked "System -> Shutdown" in Gnome. I don't have any kind of
> bootsplash. When I shutdown through Gnome I get a terminal in front of
> me with:
>
> ---
> System is shutting down, please wait...
> ---
>
> After that should appear messages like "shutting down gdm", "stopping
> alsa", "unmounting network filesystems", etcetera, etcetera. All the
> things that the init.d scripts say. They showed both in Etch and on my
> previous Lenny machine, but on this new Lenny system they don't show.

I think sometimes the messages show up on the console where gdm was
running. Try pressing Alt-F7 when you see that message (or if you're
already looking at that console, try Alt-F1).

Daniel


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 02:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org