开发者

Create a script that runs at 15 minute intervals during working hours of a week

From Monday to Friday, 9 am to 4 pm I want to hit a specific开发者_运维技巧 URI. If the hit succeeds, I want to create/overwrite a file (this part is done). I am not sure if doing this using a cron job will be better or creating a background service will be better. I intend to run this on a VPS with 1 GB of RAM. I know it's very little but that's all I can afford now. Would it be better to use a cron job or a background service?


I would vote for the cron job—it's easy enough to add a line to the crontab, or even put a custom file in the /etc/cron.d directory as follows:

*/15 9-16 * * 1-5 user /your/script/here

[EDIT] from comments:

In terms of performance and resources, neither is terribly demanding (assuming your script is well written); that being said, cron is already running, so it adds less overhead than adding another daemon.

As for maintenance, it's also easy to distribute something that simply places a file in /etc/cron.d/ to run, and doesn't have to register with init.d or upstart.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜