Search code examples
phpazureazure-webjobsazure-scheduler

Azure WebJobs that are command line based, on a schedule - no longer possible?


I use sugar CRM and it has cron.php

I'm sure that long ago in the old portal, when "web jobs PREVIEW" was visible on a web site dashboard, I made a web job that called cron.php and it all seemed to work well. I don't recall if I called cron.php directly by its URL (unlikely as it contains code to prohibit this) or if I had some other way of making command line php processor process the script (more likely, but couldn't get enough detail on the web job to check)

Around last august it stopped, not sure why, but now it seems no way is possible to set it up again how it was, or how azure now supports scheduled jobs

In the new portal I can upload a ZIP file containing a bat file, of the commands I need: essentially to

CD d:\home\site\wwwroot 
php -f cron.php

The code of cron.php checks that it was started from the command line environment. I assume this is different to launch from a URL because, as mentioned, travelling to mysite.com/cron.php doesnt seem to work, it just response redirects away to the home page of the site and doesn't write any cron log entries. When launched from a command line e.g. KUDU console or the webjob bat-file-in-a-zip-file method, it works as expected

Great, so i've got as far as uploading the zip file, making it a new On Demand job in new azure portal, and now I'm looking for a way to call that job every 10 minutes

I read this blog: https://azure.microsoft.com/en-gb/documentation/articles/web-sites-create-web-jobs/ but it's possibly out of date as it seems to imply there's a way to upload zip based files as web jobs and in the old portal, and now I only find ways to call a URL every X minutes. It also seems to refer to page options and links that no longer are found in the old portal:

Create a scheduled webjob

1) ...In the old portal go to the WebJob page and click Add.

I'm not sure what it means by "the webjob page"; the only way I can find things to do with webjobs is to go into Azure Scheduler and then into a webjob collection.

I think once upon a time "the webjob page" was accessible from the row of links one sees when they click into a website (dashboard, monitor, scale, configure..."

Also, though I can find ways to get into the SCM pages for the zip-based webjob in the new portal, I can't find a way to invoke the job from a URL, otherwise I'd plug that URL into the scheduler in the old portal

Any advice on where to go from here? New portal seems not to support schedule but provides a way to upload a script that calls and runs cron.php correctly, old portal seems not to support any way to upload a script that calls cron.php correctly but it does provide support for schedules..

Either I'm a bit dumb and missing something really obvious, or Azure team broke a rather vital pairing of scenarios (upload a script, call it on a schedule) like this for the entire world, some time recently - and I'd have though that would cause uproar, so hopefully the former is true


Solution

  • I agree with miracledev as I can see the WebJobs tab on the old portal, and it allows me to upload and schedule a zip job. enter image description here Please make sure you’ve selected a Web App, 'Webjobs' is one of Web Apps concepts that describe on https://azure.microsoft.com/en-gb/documentation/articles/app-service-web-overview/. Feel free to let us know if we have any misunderstood on your original issues.