Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-10-2013, 01:39 PM   #1
Registered: Apr 2012
Location: San Francisco, cA
Distribution: Ubunto 12.04/Debian 7
Posts: 57

Rep: Reputation: Disabled
xmacroplay in crontab -e - playing back automated mouse/keyboard in cron

Hi, I have setup a script to automatically download information from the web one time a day. I used xmacro to record and inserted the appropriate delays. it works like a champ in terminal but I can not get the infamous cron to execute it.

This is my script:
xmacroplay "$DISPLAY" < /usb160gb/linuxscript/bofa.txt

The display variable just tells it to use my current display. bofa.txt is my script. this exact line runs perfect in a terminal.

my cron file reads:

GNU nano 2.2.6 File: /tmp/crontab.FVYTdE/crontab Modified


# m h dom mon dow command
45 09 * * * /usb160gb/linuxscript/ # JOB_ID_4

my cron log (/var/syslog)

Jun 10 09:45:01 getsumsr-Inspiron-560 CRON[3761]: (getsumsr) CMD (/usb160gb/linuxscript/ # JOB_ID_4)
Jun 10 09:45:01 getsumsr-Inspiron-560 postfix/pickup[3229]: 296BC4600A5: uid=1000 from=<getsumsr>
Jun 10 09:45:01 getsumsr-Inspiron-560 postfix/cleanup[3765]: 296BC4600A5: message-id=<20130610164501.296BC4600A5@getsumsr-Inspiron-560>
Jun 10 09:45:01 getsumsr-Inspiron-560 postfix/qmgr[1943]: 296BC4600A5: from=<getsumsr@getsumsr-Inspiron-560>, size=726, nrcpt=1 (queue active)
Jun 10 09:45:01 getsumsr-Inspiron-560 postfix/local[3768]: 296BC4600A5: to=<getsumsr@getsumsr-Inspiron-560>, orig_to=<getsumsr>, relay=local, delay=0.23, delays=0.15/0.02/0/0.07, dsn=2.0.0, status=sent (delivered to mailbox)

Can anyone tell me why it does not run. I tried reading about the "ten most common reasons cron will not run including the one about cron having to have an empty line at the end. tried it all!! help!!

Last edited by escolom; 06-11-2013 at 02:10 PM.
Old 06-11-2013, 01:12 AM   #2
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
The program does probably run great from crontab.
The question is: does it do what you expect it to do?

The trouble here is that your script relies on an variable that gets defined the moment X-windows starts and is available to all sub-processes of X-windows. That's why it works great if you test from a terminal.
The problem though is that cron is not a sub-process of X-windows, so $DISPLAY is not defined and neither is it in processes that got started by cron.

Old 06-11-2013, 12:53 PM   #3
Registered: Apr 2012
Location: San Francisco, cA
Distribution: Ubunto 12.04/Debian 7
Posts: 57

Original Poster
Rep: Reputation: Disabled
Hey gdejonge, thank you for your keen response. So, there is no hope in running it thru cron? Is there another scheduler you know of that
can use the terminal and Display variable? I tried using the hard value instead of $display.. I think it was something like .0:0 and again the terminal worked with .0:0 but cron didn't like it but like you said even xmacroplay doesn't run in cron. any idea's or other software that will run xwindows terminal? Its interesting that the author of xmacro claimed cron will run it. I am wondering if there are some environmental values I need to establish, this is where me being a newbie hurts badly

to answer your question, in cron it does not do anything..only says it ran the command in the log. I tried outputting to a log but its blank.

again in terminal the thing logs on downloads my financial data does some automation in libre calc and appends data to base. its a dream script! too bad I can't get this thing to run at set times, I would even have it email me a financial report to my phone everytime I spend a I can stop spending :-)


Last edited by escolom; 06-11-2013 at 02:18 PM.
Old 06-11-2013, 10:05 PM   #4
Registered: Apr 2012
Location: San Francisco, cA
Distribution: Ubunto 12.04/Debian 7
Posts: 57

Original Poster
Rep: Reputation: Disabled

thanks to everyone!! xmacro now runs in cron!!
here is the cron line.

58 18 * * * bash -c "/usb160gb/linuxscript/"

I forced bash on it.

Thanks to everyone for the ideas!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Crontab for automated backup --> not running Wover Linux - Newbie 17 03-12-2013 09:56 PM
[SOLVED] Automated dcraw and cjpeg script from crontab henkka Programming 3 01-05-2012 03:33 PM
[SOLVED] No Keyboard or Mouse in X - Cannot get back to console. elprawn Gentoo 1 04-14-2011 10:23 PM
/etc/crontab vs /etc/cron.d vs /var/spool/cron/crontabs/ drManhattan Linux - Newbie 9 01-04-2011 02:12 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration