I know that this has been discussed in the past (see http://sourceforge.net/forum/message.php?msg_id=3952543 and other various posts), but I wanted to know if anyone has come up with a script or found a way to completely automate Statfink via cron (or any other method)? Kind of a set it up once before the season and then forget about it for the rest of the season. I ask, because there are times when I am traveling and can't get to a computer to start the tracking or when I can't leave the tracking window open all day. If there was a way to automate it, then it would just be able to run by itself and I wouldn't have to worry about it. If this isn't possible, then it might be a good feature to add. Thanks again for your input and hard work on Statfink.
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you can. here is the cron job i use to launch it. if you dont understand cron timing, i have it set to launch the helm at 7PM every thursday. however, you need to kill firefox every week when it is done, or else you get issues opening new windows. i never got the kill script (second line) to work, and have just been doing it manually either in the shell or in VNC.
if you want to play around with it, this is the kill script:
Last login: Fri Dec 12 14:48:17 on ttys000
merom:~ geoff$ ssh toaster
geoff@toaster's password:
Linux toaster 2.6.20-16-server #2 SMP Thu Jun 7 20:26:23 UTC 2007 i686
Ok, thanks! That looks pretty good. I will definitely play around with it and see if I can get it to work.
I guess my follow up question would be, what about the case where people use remote servers to host Statfink. They might not have access to launching Firefox remotely. Is there a way to automate Statfink via a script or cron that just calls the the php files in the correct order via the command line or something similar to that?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
im not even sure if it will run correctly without a browser. if that is the case. you could always script a local browser to load the remotely hosted statfink helm.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah that is a possibility, but it requires a local computer to be up and running constantly. The easiest way if you don't have you own local server would be if there was a way to cron it once on a remote server once a season and then you wouldn't have to worry about starting / stopping / restarting. The only time you would have to do anything would be if there was a new release and you wanted to upgrade. I'm not totally sure, but I think there might be a way of calling / processing the files via a script and cron. What do you guys think? Any other ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It won't currently work without a browser. There isn't really a way to launch the php scripts at the correct times because of the way the whole thing is written. Depending on what variables are passed in, they launch other scripts via javascript. The logic of when to run what is intertwined between php, mysql and javascript. Rewriting this into a cron job is a significant amount of work, and would require modification of a large portion of the files in Statfink. It is something that would be a nice feature to have, but many users do not have access to cron on their web hosts.
The official answer is yes it is possible and yes it is a feature i'd like to have at some point, but no it is not high on the priority list due to many factors. The post you link to was probably the best effort i've seen on getting this to run from a cron job, but that old python script would probably not work right with today's Statfink unfortunately.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey Guys -
I know that this has been discussed in the past (see http://sourceforge.net/forum/message.php?msg_id=3952543 and other various posts), but I wanted to know if anyone has come up with a script or found a way to completely automate Statfink via cron (or any other method)? Kind of a set it up once before the season and then forget about it for the rest of the season. I ask, because there are times when I am traveling and can't get to a computer to start the tracking or when I can't leave the tracking window open all day. If there was a way to automate it, then it would just be able to run by itself and I wouldn't have to worry about it. If this isn't possible, then it might be a good feature to add. Thanks again for your input and hard work on Statfink.
Mark
you can. here is the cron job i use to launch it. if you dont understand cron timing, i have it set to launch the helm at 7PM every thursday. however, you need to kill firefox every week when it is done, or else you get issues opening new windows. i never got the kill script (second line) to work, and have just been doing it manually either in the shell or in VNC.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=/dev/null
HOME=/home/geoff
# m h dom month dow command
0 19 * * 4 firefox --display=:1 http://ffbstats:<censored>@geolux.homelinux.com/st
atfink/helm/index.php?autoload=true
0 2 * * 2 /home/geoff/kill.sh
if you want to play around with it, this is the kill script:
Last login: Fri Dec 12 14:48:17 on ttys000
merom:~ geoff$ ssh toaster
geoff@toaster's password:
Linux toaster 2.6.20-16-server #2 SMP Thu Jun 7 20:26:23 UTC 2007 i686
#!/bin/sh
#a script to find and kill processes
#culled from http://lists.apple.com/archives/macintosh-manager/2003/Jun/msg00131
.html
mypid=`ps auw | grep firefox | grep -v grep | tr -s " " | cut -d " " -f2`
if [ 0$mypid != 0 ]
then kill $mypid
echo "`date` -- killed ${mypid}"
else echo "`date` -- no process found."
fi
oops.. ignore the console output at the top :/ script starts with the hashbang (#!)
Ok, thanks! That looks pretty good. I will definitely play around with it and see if I can get it to work.
I guess my follow up question would be, what about the case where people use remote servers to host Statfink. They might not have access to launching Firefox remotely. Is there a way to automate Statfink via a script or cron that just calls the the php files in the correct order via the command line or something similar to that?
im not even sure if it will run correctly without a browser. if that is the case. you could always script a local browser to load the remotely hosted statfink helm.
Yeah that is a possibility, but it requires a local computer to be up and running constantly. The easiest way if you don't have you own local server would be if there was a way to cron it once on a remote server once a season and then you wouldn't have to worry about starting / stopping / restarting. The only time you would have to do anything would be if there was a new release and you wanted to upgrade. I'm not totally sure, but I think there might be a way of calling / processing the files via a script and cron. What do you guys think? Any other ideas?
It won't currently work without a browser. There isn't really a way to launch the php scripts at the correct times because of the way the whole thing is written. Depending on what variables are passed in, they launch other scripts via javascript. The logic of when to run what is intertwined between php, mysql and javascript. Rewriting this into a cron job is a significant amount of work, and would require modification of a large portion of the files in Statfink. It is something that would be a nice feature to have, but many users do not have access to cron on their web hosts.
The official answer is yes it is possible and yes it is a feature i'd like to have at some point, but no it is not high on the priority list due to many factors. The post you link to was probably the best effort i've seen on getting this to run from a cron job, but that old python script would probably not work right with today's Statfink unfortunately.