Fedora Linux Support Community & Resources Center
  #1  
Old 14th July 2010, 10:17 AM
tanwald Offline
Registered User
 
Join Date: Mar 2010
Posts: 12
linuxfedorafirefox
libnotify and at-command in shell-script

Hi,

i wrote a shell-skript which should send me a message using libnotify at a specified time. the command that schedules the notification looks like that:

Code:
echo "$TAN/reminder.sh execute \"$@\"" | nohup nice -n 9 at $time $date
An example-call in a terminal would be "tan reminder tomorrow 13:00 Don't forget to eat"

$TAN is just an environment variable that stores the path to all of my scripts. At the specified time the following commands are executed:

Code:
# gnome-desktop-notification
/usr/bin/notify-send --expire-time=3600000 --urgency=critical --icon=$dialog_png 'Reminder:' "$(date +%T) $@"
# gnome-system-sound
/usr/bin/canberra-gtk-play --id="complete" --loop=3 --display=:0.0 --volume=-15 &
Everything works fine as long as there is no reboot in between the scheduling and the execution. After a reboot i only hear the system sound, the desktop notification is omitted.
at sends me the following message per mail:

Quote:
Originally Posted by libnotify per mail
libnotify-Message: Unable to get session bus: Failed to connect to socket /tmp/dbus-hmxHDz4Tki: Connection refused
XOpenDisplay() failed
I found out that at stores all enviroment variables at the time of execution. I guess this also includes the session-ID...:

Quote:
Originally Posted by at manpage
The working directory, the environment (except for the variables BASH_VERSINFO, DISPLAY, EUID, GROUPS, SHELLOPTS, TERM, UID, and _) and the umask are retained from the time of invocation.
How could I solve that?

Thanks p
Reply With Quote
  #2  
Old 17th July 2010, 11:20 PM
macemoneta's Avatar
macemoneta Offline
Registered User
 
Join Date: May 2004
Location: NJ
Posts: 913
linuxchrome
Re: libnotify and at-command in shell-script

In my crontabs, I use:

Code:
DISPLAY=:0 XAUTHORITY=/home/$USER/.Xauthority /usr/bin/notify-send "title" "message"
Reply With Quote
  #3  
Old 18th July 2010, 12:35 PM
tanwald Offline
Registered User
 
Join Date: Mar 2010
Posts: 12
linuxfedorafirefox
Re: libnotify and at-command in shell-script

Hello Macemoneta,

thank you for your answer. Did you configure xauth manually? I don't have a .Xauthority file in my $HOME
Code:
echo $XAUTHORITY 
/var/run/gdm/auth-for-tanwald-TUxO38/database
Meanwhile I made a dirty workaround that stores all jobs in a text file and reschedules them at login but if you gave me a short introduction on how to configure xauth for my issue I would be glad.

cheers p
Reply With Quote
  #4  
Old 18th July 2010, 03:56 PM
macemoneta's Avatar
macemoneta Offline
Registered User
 
Join Date: May 2004
Location: NJ
Posts: 913
linuxchrome
Re: libnotify and at-command in shell-script

I don't configure xauth manually, and there is a .Xauthority file in my $HOME. I do issue a xhost to authorize access to the display. Have you remembered to do that?
Reply With Quote
Reply

Tags
at command, libnotify, shell script

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
call remote shell script within an expect script PhillyFloyd Programming & Packaging 2 16th October 2007 10:29 PM
starting a shell script inside a php script gw348 Using Fedora 6 23rd April 2007 09:30 PM
need to run script Bourne-shell script armen Using Fedora 4 4th April 2005 01:16 PM
Shell script ieuuk Programming & Packaging 5 28th October 2004 10:51 PM


Current GMT-time: 01:06 (Thursday, 20-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat