[Pkg-cron-devel] [pkg-cron] 09/10: Document the need to set the DISPLAY environment when running scheduled tasks that interact with the user's desktop environment (LP: #891869)

Javier Fernandez-Sanguino Peña jfs at moszumanska.debian.org
Sun Mar 11 22:37:13 UTC 2018


This is an automated email from the git hooks/post-receive script.

jfs pushed a commit to branch master
in repository pkg-cron.

commit e1c5163199d5282a0dcbb37d265d29d0707ea562
Author: Javier Fernandez-Sanguino <jfs at debian.org>
Date:   Sun Mar 11 23:27:55 2018 +0100

    Document the need to set the DISPLAY environment when running
    scheduled tasks that interact with the user's desktop environment
    (LP: #891869)
---
 crontab.5 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/crontab.5 b/crontab.5
index 66ba2e4..c8230b9 100644
--- a/crontab.5
+++ b/crontab.5
@@ -263,6 +263,23 @@ MAILTO=paul
 # Run on every second Saturday of the month
 0 4 8-14 * *    test $(date +\\%u) \-eq 6 && echo "2nd Saturday"
 .fi
+
+.PP
+All the above examples run non-interactive programs. If you wish to run a 
+program that interacts with the user's desktop you have to make sure the proper
+environment variable 
+.I DISPLAY
+is set.
+
+.\" Note: Based on some web searches, below example might not fully
+.\" work in all systems, as notify-send might require also 
+.\" to have knowledge of the dbus session in use (through the environment)
+.\" However, adding that code here is an overkill
+.nf
+# Execute a program and run a notification every day at 10:00 am
+0 10 * * *  $HOME/bin/program | DISPLAY=:0 notify-send "Program run" "$(cat)"
+.fi
+
 .SH EXAMPLE SYSTEM CRON FILE
 
 The following lists the content of a regular system-wide crontab file. Unlinke a

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-cron/pkg-cron.git



More information about the Pkg-cron-devel mailing list