'at' won't show xmessage, gxmessage, zenity dialogs - SOLVED
'at' won't show xmessage, gxmessage, zenity dialogs - SOLVED
I was trying to use the 'at' command to display a reminder for me at 9pm tonight. I have a little script, which I call 'alert', that I use to put up a dialog and to play a sound to catch my attention and I use this for a little countdown timer script I wrote a while back.
I decided to use the 'at' command instead of my 'reminder' script because I couldn't be bothered calculating the time to make 'reminder' wait. The 'at' command accepts a simple target time (e.g. at 9pm <<<"play hello.wav").
The weird thing is that 'at' does run my alert script at the appropriate time, and plays the sound, but won't display the dialog.
I've tried various dialog programs ('xmessage', 'gxmessage', 'zenity') and none will display. They all have the same permissions as 'sox' (which is invoked by the 'play' command which is a link to 'sox') and my alert script. Their permissions are all
-rwxr-xr-x 1 root root
The 'at' command, however, runs as user daemon.
-rwsr-sr-x 1 daemon daemon
This could be the problem somehow, but I can't see why.
Why would it run scripts and play sounds, but not display a dialog?
Anybody got any ideas?
I decided to use the 'at' command instead of my 'reminder' script because I couldn't be bothered calculating the time to make 'reminder' wait. The 'at' command accepts a simple target time (e.g. at 9pm <<<"play hello.wav").
The weird thing is that 'at' does run my alert script at the appropriate time, and plays the sound, but won't display the dialog.
I've tried various dialog programs ('xmessage', 'gxmessage', 'zenity') and none will display. They all have the same permissions as 'sox' (which is invoked by the 'play' command which is a link to 'sox') and my alert script. Their permissions are all
-rwxr-xr-x 1 root root
The 'at' command, however, runs as user daemon.
-rwsr-sr-x 1 daemon daemon
This could be the problem somehow, but I can't see why.
Why would it run scripts and play sounds, but not display a dialog?
Anybody got any ideas?
Last edited by miriam on Wed 26 Mar 2014, 08:49, edited 1 time in total.
[color=blue]A life! Cool! Where can I download one of those from?[/color]
Sunburnt, I'm using Puppy Lucid 528, but it doesn't come with 'at' either. I downloaded it a while back as source code and compiled it. I can't remember where I got the source code. It was probably from one of the Debian mirrors, but unusual for me, I didn't keep a pointer to the address.
Amigo, I tried your suggestion of exporting the DISPLAY variable.
export DISPLAY ; at 17:20 <<<"xmessage testing ; play hello.wav"
It still didn't work (well, the sound did), but I think you might be on the right track.
if I type echo $DISPLAY
it returns:
:0.0
Any further ideas?
Amigo, I tried your suggestion of exporting the DISPLAY variable.
export DISPLAY ; at 17:20 <<<"xmessage testing ; play hello.wav"
It still didn't work (well, the sound did), but I think you might be on the right track.
if I type echo $DISPLAY
it returns:
:0.0
Any further ideas?
[color=blue]A life! Cool! Where can I download one of those from?[/color]
You are almost there.
The at command doesn't pass DISPLAY to the job. So you need to pass it directly to the command you want to run, not the at command.
So your command becomes:
(Although unrelated to the problem, note that I have also replaced the semicolon with a single ampersand. This way the sound plays in the background as soon as the message pops up. As it was, the sound wouldn't play until you dismissed the message box, which was probably not what you wanted. Alternatively, you could of course keep the semicolon and reverse the order so that the sound plays first, and the message pops up after it finishes playing.)
Since xmessage supports the -display option, you could use it if you prefer:
The at command doesn't pass DISPLAY to the job. So you need to pass it directly to the command you want to run, not the at command.
So your command becomes:
Code: Select all
at 17:20 <<< "DISPLAY=:0.0 xmessage testing & play hello.wav"
Since xmessage supports the -display option, you could use it if you prefer:
Code: Select all
at 17:20 <<< "xmessage -display :0.0 testing & play hello.wav"
There is a GUI alarm clock called pclock. It avoids using at command.
http://murga-linux.com/puppy/viewtopic.php?t=73168
________________________________________
http://murga-linux.com/puppy/viewtopic.php?t=73168
________________________________________
npierce - YAY!!! It works! Thank you. I would never have thought of doing it that way. More for me to learn about. Excellent! I love finding out about such things. And you are right about the sound playing the other way too. Oops.
I'll incorporate the "DISPLAY=:0.0" part into some of my scripts so I don't have to type it in and will be able to easily set timed alerts for myself with just a simple couple of words.
don570 - I have used 'pclock' before, but because it sets alarms with 'cron' via 'pschedule' and I find 'cron' ridiculously complicated when all I want to do is set an alarm for 9pm or whatever, I rarely use it. The 'at' command is a lot simpler, especially since I use the commandline for much of ordinary day-to-day stuff.
Other than is awkwardness, one of the things I don't like about cron is that it doesn't understand what year it is. At the moment I have a couple of reminder programs that I use to set up all my appointments, birthdays, etc on. One is 'tkremind' (part of the 'remind' package). The other is the old Unix/BSD program 'calendar', which, when coupled with a script of my own does a pretty good job. I'm dissatisfied with both 'remind' and 'calendar' so will eventually write my own, when I have time. I'll announce it on the Puppy forum when I do.
I'll incorporate the "DISPLAY=:0.0" part into some of my scripts so I don't have to type it in and will be able to easily set timed alerts for myself with just a simple couple of words.
don570 - I have used 'pclock' before, but because it sets alarms with 'cron' via 'pschedule' and I find 'cron' ridiculously complicated when all I want to do is set an alarm for 9pm or whatever, I rarely use it. The 'at' command is a lot simpler, especially since I use the commandline for much of ordinary day-to-day stuff.
Other than is awkwardness, one of the things I don't like about cron is that it doesn't understand what year it is. At the moment I have a couple of reminder programs that I use to set up all my appointments, birthdays, etc on. One is 'tkremind' (part of the 'remind' package). The other is the old Unix/BSD program 'calendar', which, when coupled with a script of my own does a pretty good job. I'm dissatisfied with both 'remind' and 'calendar' so will eventually write my own, when I have time. I'll announce it on the Puppy forum when I do.
[color=blue]A life! Cool! Where can I download one of those from?[/color]
Semme, I'm running without upstart. I hadn't even heard of it til I followed your link. I have to say it looks very interesting, especially the planned (but not yet implemented) feature, "Events generated at timed intervals or scheduled times". Reading their FAQ I see they are intending to use it to make 'at' and 'cron' obsolete. This could be a very good thing. It is intended as a replacement for 'init' (I think all Puppies use 'init'), and runs asynchronously instead of blocking tasks, which is very nice and rather like the beautiful and efficient Amiga OS, which I still love.
I notice Ubuntu (upstart was made for Ubuntu) after originally adopting upstart, have dumped it in favor of systemd, as have debian and Fedora/RedHat and OpenSuSe. I'll have to learn more about systemd and why they preferred it. I got some small sense of the great forces at work, unknown to me, in this short article: After Linux civil war Ubuntu to adopt systemd.
Hmmm... whereas upstart is available as a pet via Puppy's package manager systemd isn't. Perhaps systemd is too radical an overhaul to be simply installed.
Most interesting to me is that systemd appears to have already obsoleted cron with "a cron-like job scheduler called systemd Calendar Timers, and an event logging subsystem called journal" (the wikipedia page about systemd). I wonder how easy it is to use and whether it understands years.
It bothers me that systemd writes its logfiles as binary, which strikes me as a monumentally stupid idea and anti-human.
In an interview on http://www.linuxquestions.org/questions ... re-949029/ (about halfway down the page) in 2012, Slackware's founder Patrick Volkerding said this:
I notice Ubuntu (upstart was made for Ubuntu) after originally adopting upstart, have dumped it in favor of systemd, as have debian and Fedora/RedHat and OpenSuSe. I'll have to learn more about systemd and why they preferred it. I got some small sense of the great forces at work, unknown to me, in this short article: After Linux civil war Ubuntu to adopt systemd.
Hmmm... whereas upstart is available as a pet via Puppy's package manager systemd isn't. Perhaps systemd is too radical an overhaul to be simply installed.
Most interesting to me is that systemd appears to have already obsoleted cron with "a cron-like job scheduler called systemd Calendar Timers, and an event logging subsystem called journal" (the wikipedia page about systemd). I wonder how easy it is to use and whether it understands years.
It bothers me that systemd writes its logfiles as binary, which strikes me as a monumentally stupid idea and anti-human.
In an interview on http://www.linuxquestions.org/questions ... re-949029/ (about halfway down the page) in 2012, Slackware's founder Patrick Volkerding said this:
Thanks for pointing me to all this. Potentially exciting (and slightly worrying) stuff."Concerning systemd, I do like the idea of a faster boot time (obviously), but I also like controlling the startup of the system with shell scripts that are readable, and I'm guessing that's what most Slackware users prefer too. I don't spend all day rebooting my machine, and having looked at systemd config files it seems to me a very foreign way of controlling a system to me, and attempting to control services, sockets, devices, mounts, etc., all within one daemon flies in the face of the UNIX concept of doing one thing and doing it well."
[color=blue]A life! Cool! Where can I download one of those from?[/color]
Uh, yeah.. Miriam, I was merely asking. I installed "at" and then dwnldd and installed upstart separately. After taking a closer look at all the new folders and files scattered throughout my system, I decided to uninstall and err on the side of caution. This worked fine prior to reboot, but I think things may have gotten ugly if I hadn't. There's a lot going on with upstart, that, in my opinion warrants a closer look, considering of course, Pup's not Ubuntu.
If "at" runs without upstart I'm OK with it.
I may give it a whirl, we'll see. If and when I do, I'll update you HERE.
If "at" runs without upstart I'm OK with it.
I may give it a whirl, we'll see. If and when I do, I'll update you HERE.