任務計劃2

[root@localhost app]# cat /etc/crontab

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

MAILTO=root

 

# 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

# | 
|  |  |  |

 * 
*  *  *  *
root cron.sh

@reboot root touch /app/reboot.log

You have new mail in /var/spool/mail/root

 

 

 

[root@localhost ~]# cd  /etc/cron

cron.d/       cron.daily/   cron.deny    
cron.hourly/  cron.monthly/
crontab       cron.weekly/ 

[root@localhost ~]# cd  /etc/cron

cron.d/       cron.daily/   cron.deny    
cron.hourly/  cron.monthly/
crontab       cron.weekly/ 

[root@localhost ~]# cd  /etc/cron.d

[root@localhost cron.d]# ls

0hourly 
raid-check  sysstat

[root@localhost cron.d]# cat 0hourly

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root

HOME=/

01 * * * * root run-parts /etc/cron.hourly

[root@localhost cron.d]# which run-parts

/usr/bin/run-parts

[root@localhost cron.d]# rpm -qf  /usr/bin/run-parts

crontabs-1.10-33.el6.noarch

[root@localhost cron.d]#

 

[root@localhost cron.d]# ll /etc/cron

cron.d/       cron.daily/   cron.deny    
cron.hourly/  cron.monthly/
crontab       cron.weekly/ 

[root@localhost cron.d]# ll
/etc/cron.hourly/

total 4

-rwxr-xr-x. 1 root root 409 Nov 10  2015 0anacron

 

 

 

 

[root@localhost etc]# cd /etc/cron.d/

[root@localhost cron.d]# ls

0hourly 
raid-check  sysstat

[root@localhost cron.d]# cat 0hourly

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root

HOME=/

01 * * * * root run-parts /etc/cron.hourly

 

 

[root@localhost cron.d]# cat
/etc/cron.hourly/0anacron

#!/bin/bash

# Skip excecution unless the date has
changed from the previous run

if test -r /var/spool/anacron/cron.daily;
then

   
day=`cat /var/spool/anacron/cron.daily`

fi

if [ `date +%Y%m%d` = “$day” ];
then

   
exit 0;

fi

 

# Skip excecution unless AC powered

if test -x /usr/bin/on_ac_power; then

   
/usr/bin/on_ac_power &> /dev/null

   
if test $? -eq 1; then

   
exit 0

   
fi

fi

/usr/sbin/anacron –s

 

 

 

 

[root@localhost cron.d]# cd /etc/cron.d

cron.d/    
cron.daily/ cron.deny  

[root@localhost cron.d]# cd /etc/cron.daily/

[root@localhost cron.daily]# ls

cups 
logrotate  makewhatis.cron  mlocate.cron 
prelink  readahead.cron  tmpwatch

[root@localhost cron.daily]# whatis rm

rm                   (1p)  – remove directory entries

rm                   (1)  – remove files or directories

 

 

 

[root@localhost ~]# which crontab       //  普通用戶定義計劃任務需要借助這個工具實現

/usr/bin/crontab

You have new mail in /var/spool/mail/root

 

 

 

[root@localhost ~]# crontab -e -u fsy

* * * * * 
wall fsycron

 

[root@localhost cron]# cd /var/spool/cron/

[root@localhost cron]# ls

Fsy

 

 

[root@localhost cron.daily]# which crontab

/usr/bin/crontab

[root@localhost cron.daily]# ls  /usr/bin/crontab

/usr/bin/crontab

[root@localhost cron.daily]# ll  /usr/bin/crontab

-rwsr-xr-x. 1 root root 51784 Nov 10  2015 /usr/bin/crontab

 

 

 

[root@localhost cron]# crontab  -l                   // 查看計劃任務

no crontab for root

 

[root@localhost cron]# export  EDITOR=vim

[root@localhost cron]# crontab -e -u fsy

 

 

[root@localhost cron]# crontab  -r           
//
刪除所有的計劃任務

[root@localhost cron]# ls /var/spool/cron/      // 相當于刪除這個目錄里的所有文件

Fsy

 

 

[root@localhost cron]# cat /var/log/cron

 

 

[root@localhost cron]# vim /etc/cron.deny

[root@localhost cron]# cat /etc/cron.deny

Fsy

 

[fsy@localhost app]$ crontab -e

You (fsy) are not allowed to use this
program (crontab)

See crontab(1) for more information

 

 

[root@localhost cron]# echo >
/etc/cron.deny

 

 

[root@localhost ~]# grep -E ‘^(S|M)’  /proc/meminfo

MemTotal:        1004140 kB

MemFree:          241724 kB

SwapCached:            0 kB

Mlocked:               0 kB

SwapTotal:       4095996 kB

SwapFree:        4095996 kB

Mapped:            56584 kB

Shmem:              2924 kB

Slab:             131392 kB

SReclaimable:      62108 kB

SUnreclaim:        69284 kB

原創文章,作者:fsy,如若轉載,請注明出處:http://www.www58058.com/75860

(0)
fsyfsy
上一篇 2017-05-15 21:35
下一篇 2017-05-15 21:40

相關推薦

  • Linux安全與加密基礎(二)

    Linux安全與加密基礎(二) 常見的加密算法 SSL: Openssl與CA認證 ssh服務 dropbear AIDE sudo gpg gpg亦可用于對稱加密與文件檢驗。 文件完整性的兩種實施方式 被安裝的文件     MD5單向散列     rpm –veri…

    Linux干貨 2016-10-06
  • 軟鏈接與硬鏈接的分析

    Linux引用硬鏈接與軟鏈接,是為了實現文件的共享,更有隱藏文件路徑、增加權限安全及節省存儲等的好處。很多新手不知道軟鏈接與硬鏈接的區別,今天大家一起總結它們的區別吧^_^ 一,硬鏈接 硬鏈接的特性可以體現出什么是硬鏈接: 通過索引節點來進行鏈接,文件要有相同的inode及data block 不允許跨分區創建 只有在同一文件系統中的文件之間才可以,不能交叉…

    2017-07-22
  • N22-℡浮生.若夢 ╮第八周作業

    1、請描述網橋、集線器、二層交換機、三層交換機、路由器的功能、使用場景與區別。 集線器:集線器的主要功能是對接收到的信號進行再生整形放大,以擴大網絡的傳輸距離 網橋:是早期的兩端口二層網絡設備,用來連接不同網段。網橋的兩個端口分別有一條獨立的交換信道,       不是共享一條背板總線,可隔離沖突域…

    Linux干貨 2016-11-28
  • Linux Basics–part5

    1、顯示當前系統上root、fedora或user1用戶的默認shell ~]# grep “^\(root\|fedora\|user1\)” /etc/passwd | cut -d: -f7 或者 ~]# egrep “^(root|fedora|user1)” /etc/passwd | cut -d:…

    Linux干貨 2017-08-24
  • N26-肉肉-第二周作業

    1、Linux上的文件管理類命令都有哪些,其常用的使用方法及其相關示例演示。 常用文件管理命令有cp,mv,rm  cp :copy        -i:交互式復制,覆蓋之前提醒用戶確認;         &n…

    Linux干貨 2017-01-03
  • TCP三次握手與四次揮手

                                                      &nbsp…

    2017-09-04
欧美性久久久久