libnotify and at-command in shell-script
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Join Date
    May 2004
    Location
    NJ
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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"

  3. #3
    Join Date
    Mar 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  4. #4
    Join Date
    May 2004
    Location
    NJ
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

Similar Threads

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •