dougaxing8673 2018-10-12 20:45
浏览 131
已采纳

Cron作业根据时间重命名媒体文件

I have a media file that I would like to present to users on my site based on time of day. I would like to use a CRON job to rename the files so that I can easily manage the media being displayed.

i.e.

default media displayed on site is default.mp4

default.mp4 renamed to 0.mp4 at 03:00 and 1.mp4 is renamed to default.mp4

default.mp4 renamed to 1.mp4 at 03:00 and 2.mp4 renamed to default.mp4

default.mp4 renamed to 2.mp4 at 03:00 and 3.mp4 renamed to default.mp4

and so on....

what is the CRON job syntax for this?

  • 写回答

1条回答 默认 最新

  • drelgkxl93433 2018-10-12 21:03
    关注

    To run a script at 03:00 every day:

    0 3 * * * *
    

    Though I'm guessing you copy-pasted those lines & neglected to update the time, as what you're asking will cause multiple files to be renamed default.mp4 at the same time.

    Here's a good site for explaining CRON syntax: http://www.nncron.ru/help/EN/working/cron-format.htm

    This is a good one for testing: https://crontab.guru/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64