日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

mac 下周期调度命令或脚本

發布時間:2023/11/27 生活经验 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mac 下周期调度命令或脚本 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
crontab 是在linux服務器上部署定時任務的方法0 5 * * * /usr/bin/python /data/www/tools/mysql_backup.pycmd之前有5個項目要填,分別對應分鐘 小時 天 月 一周當中第幾天( 0-6 ,0表示星期天)填寫方法* 表示都滿足,例如 * * * * * 表示每分鐘執行一次,如果每小時執行一次,那應該這樣寫 
1 * * * * (每小時第一分鐘執行,1可以隨便改成60以內的數字)
/n 表示隔n個單位執行一次
/3 * * * * 3分鐘執行一次
1 */3 * * * 表示每隔3個小時的第一分鐘執行一次
1 1 */3 * * 表示每隔3天,當天的1點1分執行一次
1 12 * * 2,3,4,5,6 表示每周二到周6,每天中午12點1分執行
只需要掌握這2種時間用法,crontab就ok了提示:crontab 最小粒度是一分鐘執行一次,要更快,得用其它辦法,比如說寫一個daemon程序,用while true: 來做
crontab -l 查看所有crontab 列表
cronta -e 編輯crontab
crontab條目是以文件方式存儲的,可以用ls /etc/cron* 查看
標簽: linuxcrontab本文地址: http://lutaf.com/51.htm 魯塔弗原創文章,歡迎轉載,請附帶原文鏈接

?

  

Create a script you wish to run. For this example, I am going to use the awstats.pl script to update my stats. The command to run the update is: /path/to/awstats.pl -update -config=myconfig2. Create a new crontab file for your user. This is accomplished by opening the Terminal.app, found in your Application/Utilities folder. Type the following into the terminal:crontab -eIf you do not have a crontab file, one will be created for you and opened in vi.3. Choose when you would like the job to run. Every job is a line in your crontab file. The first 5 arguments specify the time to run the job, and the 6th argument is the command to run. Argument 1: Minute (0 - 59)
Argument 2: Hour (0 - 23)
Argument 3: Day of Month (1 - 31)
Argument 4: Month (1-12)
Argument 5: Day of Week (0 - 6) Sunday = 0
Argument 6: CommandSo if I want to update my stats every 30 minutes, my entry in my crontab file will look like this:*/30 * * * * /path/to/awstats.pl -update -config=myconfigSave the file, and crontab should report: crontab: installing new crontabTo see a list of your crontabs, run this command: crontab -lThat's it! Crontab will now update the stats every half hour. It also will generate an email to your local user account to let you know it did its job. Most times your local user account's mailbox will not be where you want to be notified. To forward your email, create a file in your home directory called .forward. In the file put the email address where you would like the notification to be sent to.

?有的人抱怨說 crontab 無論正確輸出還是錯誤輸出都會往 /var/mail/*** 目錄下發送郵件 append方式, 不知道別人怎么樣,在mac環境下不會出現這種情況,除非 ****** cmd , cmd 有運行錯誤,就會輸入到/var/mail/*** 里面。

?

轉載于:https://www.cnblogs.com/IamThat/p/4360794.html

總結

以上是生活随笔為你收集整理的mac 下周期调度命令或脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。