Run a command at a specific time

后端 未结 5 710
闹比i
闹比i 2021-01-31 04:36

I\'m trying to run a command at a specific time. I\'ve looked at the \"at\" command, but I don\'t know how to get it working...

Here\'s what I do:

at 184         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 05:13

    In bash or zsh you can say

    at 1843 <<< 'php /run/this/script.php'
    

    Failing that, you need to use a here document:

    at 1843 <

    You might also want to look into cron for regularly scheduled jobs; the crontab entry would look like

    43 18 * * * php /run/this/script.php
    

    (EDIT: whoops, helps to recall which version of at. I think that may have been a local mod.)

提交回复
热议问题