Web Hosting Talk







View Full Version : Cronjob every second


acegilz
11-03-2010, 07:51 PM
Hello

I would like to set some cronjobs to run every second o my windows VPS.

With windows scheduler tasks the shorter timeframe i have avaliable is "daily"

Is there any program that can help me (like crontab on linux)?

thanks

centauricw
11-04-2010, 12:31 AM
Splinterware Software makes a product called System Scheduler that may fit your needs (http://www.splinterware.com/products/wincron.htm). It's something I have used before and it works well.

NoSupportLinuxHostin
11-04-2010, 12:38 AM
If you need to do something every second, it would make more sense to rewrite your application as a service instead of scheduling a script to run once every second.

dazmanultra
11-05-2010, 12:34 PM
If you need to do something every second, it would make more sense to rewrite your application as a service instead of scheduling a script to run once every second.

My thoughts exactly - running a script every second seems a pretty inefficient way of doing something. Having it is a service will also mean that your crons don't ever overlap - i.e. one cron doesn't start until another has finished, which can have a cumulative impact on performance.

E.g. if your cron takes 1.1 seconds to run, but you're running it every second, eventually your system will become overloaded. If you create a service to handle your requirements, this won't happen (just create some logic elsewhere that checks whether your service is running every so often, and if it's not, start it).

acegilz
11-05-2010, 02:37 PM
Thanks for your answers!

I just created a batch file to run those commands.

How can i make a loop on the end to repeat everytime it ends?

Thanks

Btcc22
11-05-2010, 02:40 PM
Thanks for your answers!

I just created a batch file to run those commands.

How can i make a loop on the end to repeat everytime it ends?

Thanks

I'll assume that batch files have support for while true loops. Just stick your code in one. :)

Edit: This (http://www.robvanderwoude.com/battech_while_loops.php) may be of use.