Cron troubles

I have cron installed and working, I tested it with the follow command:

18 7 * * * touch /home/me/Documents/testfile

which tells it to make the file testfile after (then) a minute. It did that, it worked.

But when I tell it to launch a program like mpv or mousepad, nothing happens. For instance:

18 7 * * * mpv "/path/to/some/mp3"

18 7 * * * /usr/bin/mpv "/path/to/some/mp3"
18 7 * * * /usr/bin/mpv path/to/some/mp3

do nothing, and

18 7 * * * mousepad 
18 7 * * * /usr/bin/mousepad

does nothing as well. I am remembering to change the times, the 18 7 is just for example. So the service is up and running, and it works sort of, because it worked with testfile, but it won’t work with my applications.

even if I put it in a bash script, and try executing it that way, it still doesn’t work:

18 7 * * * /home/me/Documents/

So it seems that crontab by default doesn’t know how to launch GUI apps. You must tell it to do so by using:

13 8 * * * env DISPLAY=:0 mpv

The trouble is that when it launches it closes immediately. It seems to work with mousepad though, because mousepad stays open.

For whatever reason, I had the command setup correctly, and the service was running for cron, but it was not until I logged out and logged back in that cron started working properly. I guess there was another service interfering with it when I first tried it. It works now.