# Xterm -display :0 -e $command fails to run from cron



## wafflesausage (Jan 31, 2012)

Hi, I'm trying to run a cron script on my FreeBSD box. I used crontab to edit it and it is running as a non-root user. I have a line in it that says:

```
0   7      *       *       1-4     xterm -display :0 -e ls
```
. For some reason, it fails to execute. I've tried running other commands from xterm, but they fail. My $DISPLAY var is set to :0. Even when I try to 
	
	



```
xterm -display :0 -e ls
```
 from a ttyv, it fails to run as expected (with no output from the console). When I run the same command on an xterm. it works as expected. Does anyone know what might be wrong? Also, note that this is for running an audio file with mplayer as an alarm clock. I've already tried alarm-clock, but it breaks a lot and has no command line interface anyway.


----------



## wblock@ (Jan 31, 2012)

See #2: The Interrupted Unix FAQ.

Further hint: look at line 1 of /etc/crontab.  Compare with which xterm.


----------

