PDA

View Full Version : Cron on Wintel/IIS box


jwesttx
10-17-2007, 06:39 PM
Hi all,

I am a Wintel Cerberus user, running 3.x for a year on IIS & PHP 5.2. Wanted to share how I scheduled my cron e-mail checking in the new 4.0 version.
I am still withholding judgement so far, but I will say there are a few features I really miss like Custom Fields, and several of the options within Global settings. I hope the 3.x community will give feedback on the things they will miss, so that the 4.0 coders can consider including them (or an equivalent function) in this new codebase.

Okay, so on to how I did Cron on a Wintel/IIS box --- this presumes you've already successfully set up Cerberus 4.x, and further assuems you are familiar w/ setting up Scheduled Tasks within NT5+:

1. Click on Control Panel > Scheduled Task > Add Scheduled Task; then click Next
2. Scroll down to find and highlight Internet Explorer from the list of available programs, then click Next
3. Type in a name for your task (like “Cerberus Cron“), click ono the Daily option, then click Next
4. Set the time that you want this to run (maybe 6:30am, current time, etc) and click Next
5. Enter your administrator password (twice), then click Next (I used the box's local admin acct for this)
6. Click on the 'Open advanced properties' box, then click Finish
7. In the Run: box, append "-nohome http://localhost/cerberusroot/index.php/cron" to the end of IEXPLORE.EXE (where "localhost" is your server name, and "cerberusroot" is wherever you installed Cerberus and can find the main index.php file)
(note: make sure there's a space between ieplore.exe and -nohome ...)
8. Click on the Settings tab and change the 'Stop Task' option to 0 hours 1 minute, then click OK
9. Set this task to repeat every 2 minutes

Done! The task will run every 2 mins, launches a browser instance and run the browser-based cron task, then kill the iexplore.exe session once the task runs for 60 seconds. Then it will run 1 minute later, rinse/repeat.

Obviously there are probably other better ways to do this. Using php.exe would be one, but 4.0 doesn't have a cron.php file anymore, that I can see.
I suppose I could shorten the sched task to every 1 minute if I did it in a batch file (using sleep util), but I try to keep things simple and this is pretty simple.

Good luck to all...

TravisT
10-25-2007, 06:33 PM
Is there any way to get this to run reduced so it doesn't steal the focus? Makes working on the server next to impossible.

TR

jstanden
10-25-2007, 08:11 PM
PHP for Win32 usually provides a binary called php-win.exe which doesn't pop up a DOS console. For hitting a URL you'd still want to use something like wget (Win32 port: http://users.ugent.be/~bpuype/wget/).

In a Debian/Linux guy, but I've heard good things about WinCron (http://www.tomasello.com/software/wincron/index.html) and it's free. It should run applications completely in the background as a service with more flexible timers.

When I get some time I'll experiment with it and write up a wiki/KB article. That should be a step in the right direction without the annoying DOS pop-up flashing on the screen.

TravisT
10-25-2007, 08:31 PM
Thanks - that is the path I just went down and got to work. It isn't running as a service but working though.

1. Got lynx.exe and a default config file (I tried to attach - but over 97kb).
2. Made sure to change Allow All Cookies to TRUE. If I didn't do this then each time it ran from command line it hung waiting for me to manually accept the cookie. I think you can specify which domain you want to accept from as well.
3. Put the lynx.exe and lync.cfg in the php directory, in my case e:\php.
4. Created the Scheduled Task (like above) only I started it in e:\php and I use this for the command line target: e:\php\lynx.exe -dump http://localhost/cerb4/index.php/cron
5. I then configred the rest as above.

Now instead of firing up IE each time it fires upa small dos window for a second or two. If anyone needs the files or help, just ask.

Regards,

TR

jwesttx
10-29-2007, 05:07 PM
TravisT thanks for the info, I think that's a better way to run this Cron. It's pretty cool. We don't have anyone logged onto our IIS box during my sched task run, so we don't have the foucs thing. But I see what you mean about it stealing the focus when it runs, the lynx.exe way is much quieter. I'll have to check out WinCron too. Thanks again!