Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all: i did a script called MYSCRIPT like this: Code: echo "hello" /usr/bin/notify-send "hello" echo hello > /root/msg.txt saved it in /root directory, applied chmod +x So, if i ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12

    crontab + libnotify

    Hello all:

    i did a script called MYSCRIPT like this:

    Code:
    echo "hello"
    /usr/bin/notify-send "hello"
    echo hello > /root/msg.txt
    saved it in /root directory, applied chmod +x

    So, if i type in a shell: ./MYSCRIPT, it nicely show me HELLO in the shell, and HELLO in a graphical popup

    ok, now i create another script MYSCRIPTcron

    Code:
    */1 * * * * /root/MYSCRIPT
    saved it in /root directory, applied chmod +x

    now, i added it: crontab -r; crontab MYSCRIPTcron; crontab -l
    and i see it in the crontab list.

    Everytime i check /root, i can see the file called msg.txt, if i delete it, it appears each minute, so crontab is working

    BUT I CANT GET IT TO SHOW ME ANY NOTIFICACION

    i also tryed with

    Code:
    */1 * * * * DISPLAY=:0.0 /root/MYSCRIPT
    what must i do to get a popup, or a shell message with that "hello" message?

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Without checking things out too fully, the first thing that I think of is whether there could be some sort of error message.

    Try changing the line to this:
    Code:
    */1 * * * * DISPLAY=:0.0 /root/MYSCRIPT &>> /root/MYSCRIPT_log
    Now all output from the command (including any error message) will go to the given log file. Let's start by seeing if there's any sort of X error message in that file.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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