服务器A和客户B

建立两台虚拟机设立IP192.168.1.9192.168.1.8,然后PING

[root@localhost ~]# ifconfig eth0192.168.1.8

[root@localhost ~]# ifconfig eth0192.168.1.9

[root@localhost ~]# ping 192.168.1.9

PING 192.168.1.9 (192.168.1.9) 56(84) bytesof data.

服务器A

[root@localhost ~]# vim/etc/sysconfig/syslog

SYSLOGD_OPTIONS="-m 0 -r"

[root@localhost ~]# service syslog restart

[root@localhost ~]# tail -f /var/log/cron 实验结果如下

Feb 24 15:09:01 192.168.1.8 crond[4999]:(tom) CMD (echo "Hello World !!")

Feb 24 15:10:01 192.168.1.8 crond[5022]:(tom) CMD (echo "Hello World !!")

Feb 24 15:11:01 192.168.1.8 crond[5046]:(tom) CMD (echo "Hello World !!")

Feb 24 15:12:01 192.168.1.8 crond[5068]:(tom) CMD (echo "Hello World !!")

客户B

[root@localhost ~]# vim /etc/syslog.conf

# Log cron stuff

cron.*/var/log/cron

cron.*@192.168.1.9

[root@localhost ~]# service syslog restart

[root@localhost ~]# useradd tom

[root@localhost ~]# crontab -e -u tom-u指定用户)

* * * * * echo "Hello World !!"

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

Feb 24 15:13:01 localhost crond[5209]:(tom) CMD (echo "Hello World !!")

Feb 24 15:14:01 localhost crond[5233]:(tom) CMD (echo "Hello World !!")

Feb 24 15:15:01 localhost crond[5256]:(tom) CMD (echo "Hello World !!")

Feb 24 15:16:01 localhost crond[5280]:(tom) CMD (echo "Hello World !!")

Feb 24 15:17:01 localhost crond[5303]:(tom) CMD (echo "Hello World !!")

Feb 24 15:18:01 localhost crond[5327]:(tom) CMD (echo "Hello World !!")

Feb24 15:19:01 localhost crond[5352]: (tom) CMD