WordPress.org

Ready to get started?Download WordPress

Forums

No cron job necessary (a quick tutorial) (6 posts)

  1. LoneBoat
    Member
    Posted 9 years ago #

    My host would not allow me to run cron jobs, so I've been looking for a way to keep my post-by-email function running without the need for manual updates. The only way I could think to do this was to find a way to locally automate the running of my wp-mail script. I have found a way to do this using two freeware tools:

    1) VisualCron (this is basically a cron application for windows)
    2) A quick VB program I wrote myself to load a website

    With VisualCron you can set up local applications to run at specific time intervals. The crucial feature is that you are allowed to pass command-line arguments to the applications you are calling. You could use IE with an argument for your post-by-mail script, but the trouble is that you have no way to kill the instance of IE after it has called your script. This would result in an additional running instance for each time your script was run. Plus, the process is not transparent, so if you're working on your computer at the time the process runs, IE would pop up in your face and you would have to minimize it.

    To fix that, I wrote a quick VB app which utilizes a Microsoft dll control which basically is IE as a VB control. What makes this program act different from IE is that I've programmed it to accept the argument "killMe" to the program, which 1) Makes the process transparent (it doesn't interrupt you if you're working), and 2) kills the app after the script is done loading (thus you will not have hundreds of instances running if you leave your machine alone).

    I don't know what happens when Windows is left alone for a while (you know how it turns the monitor and hard disks off? I don't know if that might somehow terminate the process...), so stand by while I test it out. I'll post a follow-up tomorrow.

    Oh, and as-of-yet I haven't written any error-handling for my little app, so use at your own risk. I'll be uploading it to my website as soon as I post this, but use it at your own risk until I polish it. As it is, here's instructions on getting it to work:

    1. Download the programs (I know VisualCron is available from download.com)
    2. In the same folder you plan on running my app from, create a file called "URLs.txt" containing the URI to your wp-mail script.
    3. Install VisualCron, and set up the other app to run periodically
    4. Be sure to pass the argument "killMe" to the app (just type "killMe" in the "arguments" field when you are setting up the job)
    5. Minimize VisualCron. (it will remain in the system tray, if you actually want to quit VisualCron, you must right-click on it and select "Exit")

    That's it! At this point your post-by-mail ought to be updating automatically assuming your computer has an active internet connection.

    As I said, I'll be posting my app on my website, and if any real programmers want it (as opposed to me, I'm a just-for-fun VB guy), I'll be posting the source files as well (they're from the ancient VB version 5, so don't laugh at me, please... :0) )

    Please post any issues here...

  2. skippy
    Member
    Posted 9 years ago #

    Neat! Good work.

    My WP-Cron plugin is a pure PHP WordPress-only solution to the same problem.

  3. LoneBoat
    Member
    Posted 9 years ago #

    I've read about your plugin before. It look great! The only reason I didn't want to use it was that I wanted to be certain it was being updated, rather than relying on people, spiders, and aggregators. (I think the only person who ever really visits my website is my wife and maybe my dad sometimes. It's more of an online journal for me than an interesting website... :) )

  4. Rai
    Member
    Posted 9 years ago #

    You know that VisualCron has the built-in VCBrowser command line tool which you can use for POST or GET on your scripts?

  5. LoneBoat
    Member
    Posted 9 years ago #

    No, I didn't. How do I use that?

  6. Rai
    Member
    Posted 9 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic