Send beep to console when someone logs in

Send beep to console when someone logs in

Post by dav » Thu, 11 Mar 1999 04:00:00



How can I send a beep to the console when someone logs in.

I use bash and perl

 
 
 

Send beep to console when someone logs in

Post by David Tansl » Sat, 13 Mar 1999 04:00:00


assuming you have your LOGNAME variable set to the user
try this and you do not want it for root logins, and your console is tty0.
In the /etc/profile

if [ "$LOGNAME" != "root" ]
then
 echo -e '\007' >/dev/tty0
fi

If your console is the device console, check this out by doing a  tty   on
the console then replace the tty0 with what ever the tty command echo's
back.

Dave.T.

   -**** Posted from remarQ, Discussions Start Here(tm) ****-
http://www.remarq.com/ - Host to the the World's Discussions & Usenet

 
 
 

Send beep to console when someone logs in

Post by David Tansl » Sat, 13 Mar 1999 04:00:00


dave form dave,

my hands were going faster than my brain the echo command
should read...
echo  -e '\007' ......

thats a single quote not a double quote.

doh !

Dave.T.

   -**** Posted from remarQ, Discussions Start Here(tm) ****-
http://www.remarq.com/ - Host to the the World's Discussions & Usenet

 
 
 

Send beep to console when someone logs in

Post by Andreas Schwa » Sat, 13 Mar 1999 04:00:00




|> > How can I send a beep to the console when someone logs in.
|> >
|> > I use bash and perl
|> >
|> >
|>
|> In the .login/.profile (don't recall which bash uses) add this:
|>
|> echo "\a" > /dev/console

Nope.  This will just print 'a' on the console.

$ echo -ne "\a" >/dev/console

--
Andreas Schwab                                      "And now for something


 
 
 

Send beep to console when someone logs in

Post by Chris Thomps » Sun, 14 Mar 1999 04:00:00









>> |> > How can I send a beep to the console when someone logs in.
>> |> >
>> |> > I use bash and perl
>> |> >
>> |> >
>> |>
>> |> In the .login/.profile (don't recall which bash uses) add this:

.bash_profile, or .profile if that doesn't exist.

Quote:>> |>
>> |> echo "\a" > /dev/console

>Hmmm.... the echo "\a" worked, as did echo "\a">filename, with a cat of the
>file name ringing the bell. Granted I did not test doing this to the console
>(as I have a small aversion to playing with virtual fire).

>> Nope.  This will just print 'a' on the console.

>> $ echo -ne "\a" >/dev/console

>I'm on a DEC^h^h^hCompaq 8400, and there is no "e" option. What does this do?

This is a notoriously variable area. Don't assume that /usr/bin/echo,
/usr/ucb/echo, or the shell builtin "echo" in any of sh, csh, ksh, bash, ...
will do the same thing. Any of "-e is the default", "-e is needed", or
"-e if quoted will be treated as data" are possible [and possibly a few
others I've forgotten].

However, the original question concerned bash, so

  echo -ne "\a"

is right: the -e enables escape expansion and the -n supresses the linefeed.

Chris Thompson
Email: cet1 [at] cam.ac.uk