if it works from the command line, but fails from cron, I'm thinking it's an xwindow issue.
xhost command could be the solution there, or at least tell you why it fails.
try launching xhost + and see if your cron now works.
For the specific thing you want, I know there is a package that solves just this. It counts how many minutes in a row you've been using the computer, then if it has been more than what you set previously, it display a popup that suggests to take a break. If you voluntarily step away from the computer a few minutes from now and then, then you won't see the popup.
otherwise, with a cron, if you let the pc turned on for a day, you'll get 24 alerts when you come back ...
also, with your cron, you might get an alarm just a few minutes after connecting ...
Anyway, if someone know about that package name, please post it here, I've forgotten the name