Jump to content
  • Hello visitors, welcome to the Hacker World Forum!

    Red Team 1949  (formerly CHT Attack and Defense Team) In this rapidly changing Internet era, we maintain our original intention and create the best community to jointly exchange network technologies. You can obtain hacker attack and defense skills and knowledge in the forum, or you can join our Telegram communication group to discuss and communicate in real time. All kinds of advertisements are prohibited in the forum. Please register as a registered user to check our usage and privacy policy. Thank you for your cooperation.

    TheHackerWorld Official

定时任务-crontab简单用法

 Share


KaiWn

Recommended Posts

crotab定时任务:

  • 在服务器上设置定时器,来执行特定的任务脚本,比如php XXX或者 python XXX,或者 go run ***

crontab基本用法:
- crontab时间设置:

# 5个时间表示:分别为以下
* * * *:表示:分、时、日、月、周

crontab -e:

  • 添加crontab定时任务,
  • 例如:设置每分钟执行 进入项目目录,并且php artisan命令
# 设置每分钟执行1次该命令
* * * * * cd ~/dnmp/www/ali-php php artisan schedule >> /dev/null 2>&1

crontab -l:
* 列出当前用户的所有定时任务
- crotab -r:
* 删除当前用户的定时任务


备注:

  • 如果crontab -e添加定时任务失败,可能是当前默认编辑器为vi,需要设置为vim,
# 编辑文件,修改默认编辑器:vim ~/.zshrc  (或者.bash_profile)
export EDTTOR=vim

# 然后,source ~/.zshrc,使其生效,再重新crontab -e来添加定时任务
Link to post
Link to comment
Share on other sites

 Share

discussion group

discussion group

    You don't have permission to chat.
    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...