Automating Updates
If you want to keep your Logaholic statistics up to date automatically (i.e. without having to click the Update Now button manually), you will need to trigger the Logaholic update.php script to run at certain time intervals.
Setting up:
Related Topics:
- Updating All Profiles at once
- Setting up Email Alerts
- Using Update with Advanced Command Line Options
Linux/Unix
On Linux/Unix/Mac OSX, this is an easy and robust way to update your logaholic through a cron job. There are two methods you can use; Wget (recommended for Self Hosted Editions), and PHP command line (recommended for Service Provider Editions)
Wget Method:
This method is recommended for Self Hosted Editions, should work on most servers, and perhaps by-pass some permission issues.
Add the following command to your cron jobs, at the time interval of your choice:
wget -q -O /dev/null http://www.your-domain.com/logaholic/update.php?conf=profilename
Replace your-domain.com and profilename with the appropriate values.
If you have protected your logaholic directory with a password via a .htaccess file, you'll have to include the username and password in the URL like this:
http://username:password@www.your-domain.com/logaholic/update.php?conf=profilename
Example line in your crontab file:
50 23 * * * wget -q -O /dev/null "http://username:password@www.yourdomain.com/logaholic/update.php?conf=yourprofilename"
The example line above would start the update process each day at 23:50
If wget is not available on your machine, we recommend installing it but if that is not an option, here is another way of doing it:
PHP command line method (this is recommended for SPE versions):
You can also run the Logaholic update.php script from the command line, like this:
cd /the directory/where logaholic is/
php -q update.php profilename
Replace profilename with the name of the logaholic profile you want to update. There is a space between update.php and profilename.
In a single line command, it looks like this:
cd /the directory/where logaholic is/;php -q update.php profilename > /dev/null
It is important to run the php command from within the logaholic directory. Hence, the cd command prior to executing the update.php script.
Example line in your crontab file:
*/20 * * * * cd /thedirectory/wherelogaholicis/;php -q update.php profilename > /dev/null
The example line above would start the update process every 20 minutes.
Windows
To automate Logaholic updates on windows, you will need to create a scheduled task and download the wget program:
- Download wget for Windows at http://gnuwin32.sourceforge.net/packages/wget.htm
- Copy the wget.exe file to c:/windows
- Go to Start , Control Panel ,Scheduled Tasks ,Add Scheduled Task , Next
- Click "Browse..." and browse to C:/windows/wget.exe ,Open
- Type "Logaholic" as the name ,Daily ,Next
- Start Time: 12:00 AM , perform this task ,Every Day", Start Date: Today's Date , Next
- Enter the username and password ,Next
- Open advanced properties, Finish
- Run: C:/windows/wget.exe -q -O NUL "http://www.whatever.com/logaholic/update.php?conf=Profilename"
- On the "Schedule" tab ,Advanced
- [check]"Repeat task" ,set up as you wish
- OK
Change www.whatever.com into the domain location you have submitted when you licensed Logaholic, this could also be a Ip number.
How do I test the wget command on Windows?
- Open a dos box, you are now in your working directory.
- Copy and paste the command line you have composed above at *9.
- Take out the silencers, -q -O NUL, your command line will look like this: C:/windows/wget.exe NUL "http://www.whatever.com/logaholic/update.php?conf=Profilename" ENTER
- You will see some output in your dos box and moving <>, this means the script is running. When its done a file update.php@conf=Profilename is created in your working directory, containing a log file of what the script executed. With the silencers the script will run quitely no output is created.