[sf-lug] system beep
jim
jim at well.com
Mon Jan 18 08:24:03 PST 2010
Thanks much for the update.
I've been wondering if the system beep has somehow
dropped through the cracks of linux developers' tasks
or been ignored as olde tyme and irrelevant given
on-board sound systems.
On Mon, 2010-01-18 at 01:04 -0800, Alex Kleider wrote:
> I've learned a few things in my pursuit of this issue and am passing them on for anyone who might be interested:
> The problem is that my initial method of making the alarm noise was
> to send CTRL-A characters to standard output.
> If the at utility is used, when the script is eventually run, there is no
> attached terminal to which to send the output.
> A workaround (suggested by Akkana) was to send output directly to /dev/console but to do so, its permissions have to be modified
> (sudo chmod 602 /dev/console).
> $ echo $'\a' >/dev/console
> then works.
> This ofcourse raises some security issues, but I can't think how that could
> be much of a problem (on my personal laptop.) From a security point of view, having to change the setuid bit of the script or running it as root seemed even less desirable options to me.
> The other thing I discovered is that the syntax of the at utility doesn't
> seem to allow any parameters to be passed to the job(s). I got around this
> by using its -f option. This didn't work until all paths were specified
> as absolute paths, again, I assume, because when run, who knows what is the current working directory. By 'all paths' I mean (1) the file given to the -f option and (2) the script listed in that file.
> For example:
> $ cat time
> /home/alex/Python/Alarm/hardwareTimer -s 3
> $ at 06:00am -f /home/alex/Python/Alarm/time
> By the way, my script happens to be written in Python, but that's a different matter.
>
>
>
> --- On Fri, 1/8/10, Akkana Peck <akkana at shallowsky.com> wrote:
>
> > From: Akkana Peck <akkana at shallowsky.com>
> > Subject: Re: [sf-lug] system beep
> > To: sf-lug at linuxmafia.com
> > Date: Friday, January 8, 2010, 10:17 AM
> > > On Thu, 2010-01-07 at 17:49
> > -0800, Alex Kleider wrote:
> > > > if at the linux command line (bash shell) I type
> > > > $ echo $'\a'
> > > > the bell rings
> >
> > jim writes:
> > > when i use the command
> > > $ echo $'\a'
> >
> > Another way is to tell bash to print the beep character
> > (ctrl-G, ASCII 7):
> > $ echo -e "\007"
> >
> > But when I put either one in a script and run it through
> > at, the
> > problem seems to be that at is redirecting the output, so
> > the ctrl-G
> > never goes to a terminal that can turn it into sound. Try
> > adding
> > some visible text in your script:
> >
> > echo BEEP $'\a'
> >
> > and you'll see that you never see the BEEP either if you
> > call it
> > from at.
> >
> > If you explicitly redirect it to a terminal, it works.
> > For instance, type tty to find out what your current
> > terminal is,
> > then put that in the script:
> >
> > echo BEEP $'\a' >/dev/pts/1
> >
> > and call it from at, and it should work (it did for me).
> >
> > But that's not very convenient if you want to schedule a
> > script to run
> > days fom now, since you'd have to be sure what pty is there
> > that
> > you can write to.
> >
> > If your script can run as root, you could use the console:
> >
> > echo $'\a' >/dev/console
> >
> > Or if you're pretty sure you'll be logged in on the console
> > as
> > your own user, you could use tty0 or tty1:
> >
> > echo $'\a' >/dev/tty1
> >
> > ...Akkana
> >
> > _______________________________________________
> > sf-lug mailing list
> > sf-lug at linuxmafia.com
> > http://linuxmafia.com/mailman/listinfo/sf-lug
> > Information about SF-LUG is at http://www.sf-lug.org/
> >
>
>
>
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/
>
More information about the sf-lug
mailing list