Awstats Scheduled Task 0x1 Error

After installing Perl, Awstats, IIS6.0 and all the available Windows Updates on a system, I mapped drive shares on several other webservers. I mean, why install perl and awstats on each individual server when I can have a virtual machine ready and waiting and have no downtime on the production sites?

So I had the batch script file setup to update the stats every 5 minutes for 24 hours of every day (288 updates a day):

@echo off
cd C:\Inetpub\wwwroot\awstats\cgi-bin
awstats.pl -config=myconfig -update

I saved it as Test.bat, opened up the batch file to test it out and it ran AND updated perfectly. Yay, that wasn’t too difficult.

But then I created an automated task in Windows. Run it every 5 minutes. Error 0x1 every time. WTF??

It’s because “Perl is an interpreted language, and you cannot define a task priority or a maximum CPU usage value when you run a Perl program” (thanks Devx.com!). You have to start the command first.

So the finished code should look like this:
@echo off
cd C:\Inetpub\wwwroot\awstats\cgi-bin
start awstats.pl -config=myconfig -update

Try to run it again, works when just opening the BAT file. Then try it automated. 0x0!

Leave a Reply

Your email address will not be published. Required fields are marked *