seduction
 Language:
Welcome, Guest. Please login or register.
Did you miss your activation email?
2017/03/24, 16:56:31


Help

Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: notification via cron  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline sunrat

  • User
  • Posts: 194
notification via cron
« on: 2014/03/19, 13:22:26 »
I am trying to make a regular notification to remind me to get out of the computer chair and have a stretch regularly. This command works as a command or single line bash script:
Code: [Select]
kdialog --passivepopup 'Get off your arse' 15However running it from cron fails, crontab:
Code: [Select]
*/5 * * * * /home/roger/bin/motivation-popup >> /home/roger/motivation.log 2>&1Log error:
Code: [Select]
Wednesday 19 March  23:15:01 EST 2014
kdialog: cannot connect to X server
Is there a simple way to modify the script to make it work? It's probably pretty basic but so is my scripting knowledge.

Offline bluelupo

  • Global Moderator
  • User
  • *****
  • Posts: 1.948
    • http://bluelupo.net
Re: notification via cron
« Reply #1 on: 2014/03/19, 13:40:02 »
Hi sunrat,
if you do not have X running on your cronjob will report this error. You have to make sure in your script that runs under that user of this cron job also runs an X session.
Ciao bluelupo
BlueLupo's Wiki - BlueLupo's Blog
BlueLupo bei GooglePlus
Bluelupo bei Diaspora*

Offline sunrat

  • User
  • Posts: 194
Re: notification via cron
« Reply #2 on: 2014/03/19, 15:40:07 »
Thanks bluelupo. A little more research and I got it work by adding DISPLAY ENV to crontab
Code: [Select]
*/15 * * * * env DISPLAY=:0 /home/roger/bin/motivation-popup