如何外包周期性任務(即“雲”中)?

[英]How to outsource a periodic task (i.e., in the 'cloud')?


Say a client is happy with the work you've done creating a script to accomplish a task that gathers some information and outputs a hefty database file. Then, they're interested in having the task run periodically (approximately monthly) without human intervention. The client is not interested in running the task locally, so you're forced to find somewhere else to do it -- somewhere, as hokey as it sounds, "in the cloud."

假設客戶對您完成的工作感到滿意,該工作創建了一個腳本來完成收集某些信息並輸出大量數據庫文件的任務。然后,他們有興趣定期(大約每月一次)運行任務而無需人工干預。客戶端對在本地運行任務不感興趣,所以你不得不在其他地方找到它 - 在某個地方,就像它聽起來的那樣,“在雲端。”

What techniques/services would you use to accomplish this cheaply?

你會用什么技術/服務來廉價地完成這項工作?

Things I've explored so far:

到目前為止我已經探索過的事情:

  • Amazon EC2. Sounds like a good idea, but there's no obvious way to stop and restart instances on a schedule. Paying >$70/month to keep an instance running cron but doing nothing useful seems like a waste.
  • 亞馬遜EC2。聽起來不錯,但沒有明顯的方法來按計划停止和重啟實例。支付> 70美元/月以保持實例運行cron但無所作為似乎是浪費。

  • Bite the bullet and pay for a Virtual Private Server (VPS). Again, though, even paying $20/month (Slicehost, for instance) seems like overkill if the task is only going to be running a few hours out of every month.
  • 咬緊牙關並支付虛擬專用服務器(VPS)的費用。盡管如此,如果任務每個月只運行幾個小時,即使每月支付20美元(例如Slicehost)似乎也有點過頭了。

  • A shared hosting account and WebCron. Seems a little MacGyverish and possibly violating the ToS of many shared hosting services, which don't often take kindly to long-running tasks.
  • 共享主機帳戶和WebCron。似乎有點MacGyverish並且可能違反許多共享托管服務的ToS,這些服務通常不會對長期運行的任務產生好感。

Do you have experience with these or any other options?

您對這些或任何其他選擇有經驗嗎?

4 个解决方案

#1


I would use Amazon EC2. Just fire up an instance, copy the script to the instance, add it to the start up routine and append a shutdown to the end of the script. Bundle it into your own image and shutdown the instance. Now you can just fire up your own image monthly and it will execute the script and shutdown. You will only pay 10¢/hour with a m1.small instance.

我會使用Amazon EC2。只需啟動一個實例,將腳本復制到實例,將其添加到啟動例程,並在腳本末尾附加關閉。將其捆綁到您自己的映像中並關閉實例。現在,您可以每月啟動自己的映像,它將執行腳本並關閉。您只需支付10美分/小時的m1.small實例。

You just need someone manually starting the instance monthly or have your client install a small monthly cronjob to start the instance.

您只需要有人手動每月啟動實例,或讓您的客戶端安裝一個小的月度cronjob來啟動實例。

Note: shutdown -h is required, otherwise instance will reboot instead of halt

注意:shutdown -h是必需的,否則實例將重新啟動而不是停止

#2


I'd bite the bullet and get a VPS, after 6 months you'll almost certainly find that you've found a lot more uses for it.

我會咬緊牙關並獲得VPS,6個月后你幾乎肯定會發現你已經找到了更多的用途。

I use a shared hosting service that allows this, and use it for a nightly sync.

我使用允許此功能的共享托管服務,並將其用於夜間同步。

#3


Running the task itself on EC2 actually sounds very relevant, but running the cron itself on EC2 is indeed waste.

在EC2上運行任務本身聽起來非常相關,但在EC2上運行cron本身確實是浪費。

I can't think of how to run the cron on a machine that isn't yours.

我想不出如何在不屬於你的機器上運行cron。

#4


You can use http://guardiano.pm and than with that you create a job and call your api when you want. Guradiano will than call your/api/dothat and the app will execute some task. One wat to secure that is to send some parameter with the request and only if the right parameter is sent you will execute the action.

您可以使用http://guardiano.pm而不是創建作業並在需要時調用您的api。 Guradiano將打電話給你/ api / dothat,應用程序將執行一些任務。確保這一點的一個問題是發送一些帶有請求的參數,並且只有在發送了正確的參數時才會執行操作。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/01/09/72a32dd2df7611d117ba08c339c259f0.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com