PDA

View Full Version : [ubuntu] 9.10 broke my cron firefox launch



dustin.kerber
November 2nd, 2009, 09:27 PM
Hey everyone,

So, I have a kiosk with a very simple cron script to make sure that firefox is open. If firefox is not open, it will then open it.

This script has been working fine in 9.04, but now that I am on 910, it refuses to open firefox. If I run the script manually, it works fine, but in the event it is launched from cron, firefox just doesn't open.



#!/bin/bash
if [ "$(ps aux | grep "firefox" | grep -v grep)" == "" ]
then
firefox &
fi


Edit: Clarification

dustin.kerber
November 3rd, 2009, 05:47 PM
If anyone could help me out with this, I would really appreciate it. I keep thinking it might be some sort of permission issue, but I am at a loss. Any ideas?

yeleek
November 3rd, 2009, 05:55 PM
interesting - nothing wrong with that script.

Is cron even starting the script do you know? i.e. is it an issue re executing the script rather than executing ff?

dustin.kerber
November 3rd, 2009, 07:09 PM
Cron does appear to be starting. To test, I added a line for debugging.



if [ "$(ps aux | grep "firefox" | grep -v grep)" == "" ]
then
date >> /home/kiosk/Desktop/test
firefox &
fi


I have been tailing the test file and it is updated every minute.

My cron entry is as follows


* * * * * /home/kiosk/ssh_tunnel.sh

dustin.kerber
November 4th, 2009, 04:19 PM
Could it be something to do with having to state the display to launch on? Frankly, I am grasping at straws...

dustin.kerber
November 5th, 2009, 06:20 PM
I also tried setting my cron entry to


* * * * * DISPLAY=:0.0 /home/kiosk/ssh_tunnel.sh


Still no go.

The annoying part is that this works fine if I run the script manually. Any other ideas?

wojox
November 5th, 2009, 06:31 PM
Try:


*/1 * * * * <username> /home/kiosk/ssh_tunnel.sh

dustin.kerber
November 5th, 2009, 06:39 PM
My cron entry now reads


*/1 * * * * kiosk /home/kiosk/ssh_tunnel.sh


Now, the test file isn't getting updated at all, so it appears the script isn't being run.

dustin.kerber
November 5th, 2009, 07:11 PM
Same thing with


*/1 * * * * root /home/kiosk/ssh_tunnel.sh

dustin.kerber
November 5th, 2009, 07:14 PM
What I really can't figure out is why this would work perfectly in 9.04, but be broken in 9.10...

wojox
November 5th, 2009, 07:21 PM
Is this running it's own crontab or did you add it to /etc/crontab?

What happens if you drop the file extension .sh?

dustin.kerber
November 5th, 2009, 07:26 PM
Dropping the .sh extension didn't seem to make any difference.

I am adding it to cron via 'crontab -e'.

dustin.kerber
November 5th, 2009, 11:23 PM
Is there any way for me to debug cron that might help?

dustin.kerber
November 9th, 2009, 05:52 PM
Come on, I know there is at least one Linux Guru out there who has an answer for me. Please?

Dakra
November 11th, 2009, 03:44 PM
I have problems with cron/anacron, too. I've googled the issue for a while and I have found the chkconfig command: (I had to install it first: sudo apt-get install chkconfig)

chkconfig --list | grep cron
anacron 0:off 1:off 2:off 3:off 4:off 5:off 6:off
cron 0:off 1:off 2:off 3:off 4:off 5:off 6:off
I have read some of them should be 'on'. The thing is I don't know what I'm supposed to do to turn them 'on'.

dustin.kerber
February 9th, 2010, 07:09 PM
I just wanted to pop in and say that it appears one of the recent updates fixed my issues. Thanks for your help, all!