计划上传的解决方案 - cron工作? [英] solution for scheduled uploads - cron job?

查看:164
本文介绍了计划上传的解决方案 - cron工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 最初上传内容

    li>
  2. 在定义的时间推送它

我不知道如何使用这样的东西。



我试图将.html,.php和.jpg文件上传到多个不同的目录,在同一个未来时间。



我使用的是Linux,cPanel,PHP。典型的LAMP堆栈+ cPanel。



任何输入都可以。

解决方案

> cron真的很容易。编辑作业类型

  crontab -e 

这将给你一个空白文件,其中包含解释其结构的注释。
使用带有通配符的数字来说明何时运行东西,然后运行什么。
例如,从此页面, p>

 #在午夜后运行5分钟,每天
5 0 * * * HOME / bin / daily.job> > $ HOME / tmp / out 2>& 1
#每月第一天下午2:15运行 - 输出邮件发送到paul
15 14 1 * * $ HOME / bin / monthly
#在工作日下午10点运行,annoy Joe
0 22 * * 1-5 mail -s这是10pmjoe%Joe,%%你的孩子在哪里?%
23 0-23 / 2 * * * echo运行23分钟后中午2点,

cron 会定期运行命令,如果你只想运行一次,你需要,参见此处
例如

  at -f myscript.sh 2:00 7月13日


I'm trying to find the best solution for scheduling uploads to my server to specific directories.

  1. initially uploading the content
  2. pushing it live at the defined time

I've heard cron job recommended, but I've no idea how to use such a thing.

I'm trying to upload .html, .php, and .jpg files to multiple different directories all at the same future time.

I'm using Linux, cPanel, PHP. Typical LAMP stack + cPanel.

Any input is appreciated.

解决方案

cron is really easy. To edit the jobs type

crontab -e

This will give you a blank file with comments explaining its structure. You use numbers with wild cards to say when to run things, and then what to run. For example, from this page,

   # run five minutes after midnight, every day
   5 0 * * *       $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
   # run at 2:15pm on the first of every month -- output mailed to paul
   15 14 1 * *     $HOME/bin/monthly
   # run at 10 pm on weekdays, annoy Joe
   0 22 * * 1-5    mail -s "It's 10pm" joe%Joe,%%Where are your kids?%
   23 0-23/2 * * * echo "run 23 minutes after midn, 2am,

cron will run the command regularly. If you just want it to run once, you need at. See here e.g.

at -f myscript.sh 2:00 july 13

这篇关于计划上传的解决方案 - cron工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆