简体   繁体   中英

Deploying Azure Cloud Service on a Schedule

  1. I want to host an Azure Website and I need to run a PHP script on the site every hour. Usually I would do something like this using cron jobs. Is Azure WebJobs via Azure Scheduler the only option to accomplish this?

  2. Using PHP or a REST API via PHP cURL, how do I create and deploy an Azure cloud service worker role to run some back-end PHP software independent of the website?

  3. How would pricing work for the cloud service? Would I only be paying while it is deployed, or would I be paying when it is created also? Eg Could I create the service via Azure portal and deploy via PHP to get same pricing with less coding?

  4. How do I stop a cloud service once it is done processing?

  1. You can use the Azure WebJobs under the website as you pointed out. You can also use the Azure scheduler direct and have it fire a call to another website or even an external system somewhere to kick something off. There is also a scheduler in the Azure Marketplace you could look at. Another option is the Azure Automation , which allows you to run a script separate from a web site or other deployment, though is PowerShell.

  2. You can create deployments using the Azure Management REST API. Here is some documentation on how to use the API from PHP . As for running this independent from the website, you'd either need to run this from an external system, or from a VM running within Azure.

  3. You pay for the Cloud Service from time it starts its deployment until the deployment is deleted. You pay only when something is deployed to the Cloud Service. If you create a cloud service via the portal or script, but don't deploy anything, then you aren't charged anything. When you deploy something into the cloud service you will be charged for as long as the deployment is there.

  4. Based on this question I'm assuming you mean the cloud service is some sort of back end processing. You could have the cloud service use the management api to shut itself down, but that would require that the management certificate be deployed with the cloud service, which some people don't like to do for security reasons. Other folks would have the worker roles push messages to an external system, or another service running in Azure, to say that they are done and it would then reach out and shut them down. There are really several options here depending on if you want it all managed in the cloud or have resources elsewhere that would perform the shutdown. The link to the management APIs above will give you "how to" shut them down, but the decision on what does that is really pretty open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM