最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

淺談:linux cron 計劃任務(wù)常用符號小結(jié)

 更新時間:2015年10月12日 10:08:51   投稿:mrr  
本文給大家介紹linux cron計劃任務(wù)常用符號小結(jié),感興趣的朋友跟著小編一起學(xué)習(xí)吧

 [root@wx-a ~]# crontab --help
crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage: crontab [-u user] file
crontab [-u user] [ -e | -l | -r ]
(default operation is replace, per 1003.2)
-e (edit user's crontab) 編輯crontab 工作內(nèi)容
-l (list user's crontab) 查看crontab工作內(nèi)容
-r (delete user's crontab) 刪除所有的crontab任務(wù)
-i (prompt before deleting user's crontab)
-s (selinux context)

默認(rèn)情況下,任何用戶只要不被列入/etc/cron.deny 當(dāng)中,都可以執(zhí)行”crontab –e” 去編輯自己的例行性命令了,

代表的意義

分鐘

小時

日期

月份

數(shù)字范圍

0-59

0-23

1-31

1-12

0-7


周的數(shù)字為0-7時,都代表”星期天”的意思,

輔助字符

特殊字符

代表意義

*(星號)

代表任何時刻都接受的意思,

,(逗號)

代表分割時段的意思,如果要執(zhí)行2:00與4:00時,

0 2,4 * * * command

時間參數(shù)有五列,第二列就是2,4 代表2:00 與4:00

-(減號)

代表一段時間的范圍,例如7點到10點之間的每小時10分鐘都進(jìn)行一次

工作: 10 7-10 * * * command

第二列變成7-10 代表7 8 9 10

/n(斜線)

那個n代表數(shù)字,即是每隔n單位間隔的意思,例如每5分鐘進(jìn)行一次,

則: */5 * * * * command

也可以寫成0-59/5 意思相同

系統(tǒng)任務(wù)計劃

[root@wx-a ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

crontab -e是針對用戶的cron來設(shè)計的。

基本上cron這個服務(wù)的最低檢測限制是”分鐘”,所以cron每分鐘去讀取一次/etc/crontab 與/var/spool/cron 里面的數(shù)據(jù)內(nèi)容。

標(biāo)準(zhǔn)輸出(stout): 代碼為1 使用>或>>

標(biāo)準(zhǔn)錯誤輸出(stderr): 代碼為2 使用2> 或2>>

黑洞/dev/null

錯誤輸出 2>&1

cron 讓計劃任務(wù)不在屏幕上輸出采用 > /dev/null 2>&1

[root@wx-a ~]# crontab -l
*/1 * * * * echo "hello" >> /tmp/test.txt
[root@wx-a ~]# cat /tmp/test.txt
hello
[root@wx-a ~]# cat /tmp/test.txt
hello
hello

讓輸出到黑洞里面去

[root@wx-a ~]# crontab -l
*/1 * * * * echo "hello"
[root@wx-a ~]# crontab -l
*/1 * * * * echo "hello" >/dev/null 2>&1 輸出到黑洞了

其他的幫助可以查看 man   cron  或者man  crontab

ps:ocsng linux客戶端安裝

aptitude -y install gcc automake autoconf libtool make
aptitude -y install dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libnet-ssleay-perl
aptitude -y install libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap
tar –xvzf Ocsinventory-Agent-2.0.x.tar.gz
cd Ocsinventory-Agent-2.0.x
env PERL_AUTOINSTALL=1 perl Makefile.PL
make
make install

相關(guān)文章

最新評論

鹿泉市| 称多县| 延寿县| 鹤壁市| 周口市| 彰化市| 恩平市| 曲麻莱县| 通山县| 澎湖县| 大方县| 伊春市| 中卫市| 油尖旺区| 古田县| 沐川县| 凌云县| 从江县| 会同县| 应城市| 开平市| 灌云县| 岢岚县| 麻栗坡县| 谢通门县| 德令哈市| 景泰县| 武川县| 临洮县| 新竹市| 宁津县| 张家口市| 佛坪县| 壤塘县| 滕州市| 白城市| 宣汉县| 永年县| 嘉善县| 德保县| 永靖县|