|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc |
|
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
please, what's the solution to be notified by a kdialog msgbox, when a script which include something like "kdialog --msgbox "hello" is launched via Cron (as user, not root) ? I tried this http://nixforums.org/about165610.html (give permission to user with .Xauthority) but the message is always Code:
kdialog: cannot connect to X server |
|
|||
|
In general you should not run interactive programs from cron.
|
|
|||
|
What could be the problem(s) launching personal scripts using cron ?
I've found a solution just writing kdialog --display :0.... |
|
|||
|
What happens if you are not running an X server when the job starts? What happens if you are not around to deal with the interaction?
|
|
|||
|
Quote:
Quote:
But... How could it be possible to make such an automatic job (every days at 17:45) without using cron ? |
|
|||
|
No, it's not dangerous, but if you run something interactive from cron, what should it do if you are not around? Although seeing as it's only a notification, kdialog will just fail if there is no X server or the X server belongs to some other user, so nothing happens so that's probably what you want anyway.
You could send yourself some email when the job finishes. |
|
|||
|
Another possibility is to run the "write" program like this:
echo "Job finished" | write pc54g2 Substitute with your username of course. If you have allowed writes to the terminal with "mesg y", then you will see a popup appear. |
|
|||
|
In fact, at 17:45 I can be sure that I will be around the computer, and not in int3 level. Of course a problem is possible, but the probability is low. And I'm alone to use this computer.
Yes, email and "write" are good ideas too. In fact, in kdialog's msgbox, there's the content of a text file (file.txt) which results from the execution of the scripts (each script correctly executed write something in this file.txt). I tried : Code:
cat file.txt | write pc54g2 |
|
|||
|
Yes, kwrited also depends on there being a display. But if you happen to be logged in on a terminal line, e.g. ssh, and have mesg enabled, it will go there.
write pc54g2 < file.txt is shorter. And seeing as there is output, mailing yourself the output would be a good idea. Although you could simply let the output go to stdout in the job, either by default or explicitly (cat file.txt), and the output of a cron job will be mailed to the owner. |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|