Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Startup Notification for a Headless Server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ben_h
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2002
Posts: 118
Location: Australia

PostPosted: Mon Oct 27, 2003 4:03 am    Post subject: Startup Notification for a Headless Server Reply with quote

I've been playing with bash this morning, and although this isn't exactly a montrous tip, I thought it was kind of neat :D

I've got a server with no screen, that takes a while to start up. So, I wanted some sort of indication that it was ready, and also, that the machine actually started -- i.e. fsck didn't fail, etc.

First,
Code:
emerge beep


Then just put this in /etc/conf.d/local.start:
Code:
for ((i = 0; i < 20; i++)); do

        FREQ=$(((RANDOM + 200) / 6))

        beep -f $FREQ -l 50
done


And the machine will make a random feeping progression once it's finished booting. Reminds me of Doctor Who 8)


Last edited by ben_h on Mon Oct 27, 2003 7:54 am; edited 2 times in total
Back to top
View user's profile Send private message
roofy
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2003
Posts: 86
Location: miami

PostPosted: Mon Oct 27, 2003 6:37 am    Post subject: Reply with quote

wow....i love you....dude ive been trying to do the same thing with cat /dev/urandom /dev/dsp
_________________
/* event horizon */
Athlon XP 2100+ (o/c'ed to 2.1ghz)
LanParty NForce2 Ultra
80GB Maxtor HD
48x CD-RW
ATI 9700 Pro
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Mon Oct 27, 2003 1:22 pm    Post subject: Reply with quote

When i built my development server at home, i had the very same "question/problem" in mind and i wanted to push this even further - having the ability to play wav files on the pc-speaker.

So i've looked around the Net and found the pcsp driver from Michael Beck which provides an OSS compatible interface to the PC Speaker. I've sampled various sounds from various movies (e.g. Bladerunner, the scene where Decker is sitting at home at his computer and zooming into the photo) which i use now for all kind of events - e.g. boot finished, incoming mail, alarms etc.

Unfortunately, the driver hasnt been ported yet to 2.5.x (and 2.6.x) as the OpenSound System has become pretty much obsolete. So this driver only works with 2.4.x and older kernels. But as my development server still runs a 2.4 kernel that doesnt matter much either.
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
ben_h
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2002
Posts: 118
Location: Australia

PostPosted: Mon Oct 27, 2003 1:49 pm    Post subject: Reply with quote

I read about pcsp a little while ago, but never tried it out. I think I'll have to now, although my server is running 2.6.0-test8 at the moment. I'll just back it down to 2.4.22 if need be, as I'm not getting any extra functionality from 2.6 on the server (apart from the beautiful scheduling, the new IDE subsys.... drool)
Back to top
View user's profile Send private message
tredman2
Apprentice
Apprentice


Joined: 06 Dec 2002
Posts: 169
Location: Holiday, FL

PostPosted: Sat Dec 20, 2003 1:33 am    Post subject: Audible Alert Reply with quote

Beaut.

Anybody figured out how to do something similar on shutdown? I have a headless system in an old industrial rack-mount case. It has one of the AT-style power supplies, so APM and APCI won't power off the system through software. Is there any way to issue the beeps right before the "Power Down" message, short of hacking the kernel? (and don't think I haven't throught about doing that)

Tim
_________________
Tim
"I drank what?" - Socrates, 399 BCE
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Sat Dec 20, 2003 3:33 am    Post subject: Reply with quote

Why not make it an init script in /etc/init.d, with one set of beeps on start(), another in stop()....
_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
gkmac
Guru
Guru


Joined: 19 Jan 2003
Posts: 333
Location: West Sussex, UK

PostPosted: Sat Dec 20, 2003 4:15 pm    Post subject: Re: Audible Alert Reply with quote

My server does this when it finishes booting...
Code:
beep -f 262 -n -f 524 -n -f 1048
...which plays middle C, the C one octave up and then two octaves up. man beep enables you to find out which frequencies are to which notes (e.g. 440 is the A above middle C), the frequency table is near the bottom.
tredman2 wrote:
Anybody figured out how to do something similar on shutdown? It has one of the AT-style power supplies, so APM and APCI won't power off the system through software. Is there any way to issue the beeps right before the "Power Down" message, short of hacking the kernel?
Not as far as I know. My server has an AT-style power supply too, but my kernel does spin down the hard drive right at the end of the shutdown process, so if I put my ear next to the server I can hear it spin down and know it's safe to turn the power off.
Back to top
View user's profile Send private message
tredman2
Apprentice
Apprentice


Joined: 06 Dec 2002
Posts: 169
Location: Holiday, FL

PostPosted: Sun Dec 21, 2003 5:14 pm    Post subject: Server Shutdown Reply with quote

gkmac,

Mine does something similar, but the problem is that if, for some reason, one of my kids or my wife has to shut the server down, I want it to be something a little more obvious. As it is, I have to leave a monitor plugged into it so that it at least gives the Power Down message to them. Other than that, there's no reason for the monitor to be there.

Tim
_________________
Tim
"I drank what?" - Socrates, 399 BCE
Back to top
View user's profile Send private message
gkmac
Guru
Guru


Joined: 19 Jan 2003
Posts: 333
Location: West Sussex, UK

PostPosted: Sun Dec 21, 2003 9:13 pm    Post subject: Re: Server Shutdown Reply with quote

tredman2 wrote:
if, for some reason, one of my kids or my wife has to shut the server down, I want it to be something a little more obvious. As it is, I have to leave a monitor plugged into it so that it at least gives the Power Down message to them.

Short of training your kids or wife to listen closely to the server for the hard drive spin down, you could consider asking them to reboot it... don't stop reading just yet!

If you want them to shut the server down, ask them to reboot it. Then, after the reboot completes (and thus the drives are unmounted) the BIOS will self-test and then... BEEP!

After that beep there is a window of a few seconds before any partitions are remounted read/write. Because LILO/GRUB loads, waits a bit before booting unattended, loads the kernel which then does it's stuff, then loads init... all this and no drive is written to. Even my Athlon XP2000+ takes about 8 seconds between beep and remounting read/write, plenty of time to pull the plug.

So if there's no other option, that work-around may be an option providing your kids or wife have a quick sense of timing, or you could alter LILO/GRUB to wait something like 30 seconds giving plenty of time for a safe pre-boot switch-off.
Back to top
View user's profile Send private message
Jeedo
Apprentice
Apprentice


Joined: 02 May 2003
Posts: 202
Location: Akureyri, Iceland

PostPosted: Sun Dec 21, 2003 9:33 pm    Post subject: Reply with quote

Code:

while true ; do beep -f $(cat /dev/urandom | head -c 10| cksum | head -c 4) -l $(cat /dev/urandom | head -c 10| cksum | head -c 2); done


Enjoy
Back to top
View user's profile Send private message
tredman2
Apprentice
Apprentice


Joined: 06 Dec 2002
Posts: 169
Location: Holiday, FL

PostPosted: Mon Dec 22, 2003 12:49 am    Post subject: Beep on shutdown Reply with quote

I don't know if anybody here would have the answer to this, but does the printk() function in the kernel take all of the same escape sequences that the standard C library printf does? I know it does \n, but I don't know if it does any of the other ones. If that's the case, it's just a matter of plugging in one or two \a sequences in the message that prints "Power down."

If not, I guess I could keep looking.

Tim
_________________
Tim
"I drank what?" - Socrates, 399 BCE
Back to top
View user's profile Send private message
b0fh
Guru
Guru


Joined: 16 Jun 2003
Posts: 426

PostPosted: Sat Jan 10, 2004 4:17 pm    Post subject: Reply with quote

Code:
for ((i = 0; i < 20; i++)); do

        FREQ=$(((RANDOM + 200) / 6))

        beep -f $FREQ -l 50
done


Wow, what a great sound, makes me thing the aliens are right in my room :) Doesn't anybody know how to port that pc-speaker driver to 2.6? I'd love to play the microsoft-sound when my server boots up :)
Back to top
View user's profile Send private message
Loki|muh
n00b
n00b


Joined: 30 Jan 2003
Posts: 54

PostPosted: Thu Feb 26, 2004 3:15 pm    Post subject: Reply with quote

http://www.geocities.com/stssppnn/pcsp.html

there it is ;)
Back to top
View user's profile Send private message
TheCoop
Veteran
Veteran


Joined: 15 Jun 2002
Posts: 1814
Location: Where you least expect it

PostPosted: Thu Feb 26, 2004 7:13 pm    Post subject: Reply with quote

couldnt you use the alsa oss emulation to use pcsp somehow?

or port it to alsa somehow?
_________________
95% of all computer errors occur between chair and keyboard (TM)

"One World, One web, One program" - Microsoft Promo ad.
"Ein Volk, Ein Reich, Ein Führer" - Adolf Hitler

Change the world - move a rock
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Thu Feb 26, 2004 10:01 pm    Post subject: Reply with quote

Emerging beep on my server now...I tried this on my desktop, it's like R2-D2 :lol:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum