Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1741961
  • 博文数量: 297
  • 博客积分: 285
  • 博客等级: 二等列兵
  • 技术积分: 3006
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-06 22:04
个人简介

Linuxer, ex IBMer. GNU https://hmchzb19.github.io/

文章分类

全部博文(297)

文章存档

2020年(11)

2019年(15)

2018年(43)

2017年(79)

2016年(79)

2015年(58)

2014年(1)

2013年(8)

2012年(3)

分类: LINUX

2015-10-26 14:51:15

1. 由时间引起的:
编译安装Sys-Statistics-Linux

点击(此处)折叠或打开

  1. perl Makefile.PL
  2. make
  3. make install
每次make 都会报错,我一直在考虑各种包的依赖关系,终于让发现了不少包需要装。

点击(此处)折叠或打开

  1. yum install perl-Time-HiRes
  2. yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
  3. yum install perl-Test-Simple perl-Test-Harness perl-Test-Pod-Coverage perl-Test-Pod
但是其实真正的问题出在哪里呢?时间是错误的,更新完时间后, Sys-Statistics-Linux安装成功,nrpe也安装成功了。

点击(此处)折叠或打开

  1. date
  2. Mon Jan 5 19:38:08 EST 1970
  3. ntpdate 192.168.*.*         //ntpdate update time
2. 链接:
用一个账户kobe建立一个1.txt,然后用root来分别对这个文件做软链接和硬链接。
A.可以看到硬链接保持了文件oid和gid, 而我用root 建立的软连接 3.txt 则uid和gid 都是root.

点击(此处)折叠或打开

  1. 4 -rw-rw-r--. 2 kobe kobe 14 Oct 23 09:30 1.txt
  2. 4 -rw-rw-r--. 2 kobe kobe 14 Oct 23 09:30 2.txt
  3. 0 lrwxrwxrwx. 1 root root 5 Oct 23 09:33 3.txt -> 1.txt
B. 可以看到硬链接和原始文件的Inode是相同的,而软连接则不是。

点击(此处)折叠或打开

  1. [root@c653f1u25 tmp]# stat 1.txt
  2.   File: ‘1.txt’
  3.   Size: 14     Blocks: 8 IO Block: 4096 regular file
  4. Device: fd00h/64768d    Inode: 5846 Links: 2
  5. Access: (0664/-rw-rw-r--) Uid: ( 1000/ kobe) Gid: ( 1000/ kobe)
  6. Context: unconfined_u:object_r:user_tmp_t:s0
  7. Access: 2015-10-23 09:32:04.204412959 -0400
  8. Modify: 2015-10-23 09:30:17.986761312 -0400
  9. Change: 2015-10-23 09:31:55.253358045 -0400
  10.  Birth: -
  11. [root@c653f1u25 tmp]# stat 2.txt
  12.   File: ‘2.txt’
  13.   Size: 14     Blocks: 8 IO Block: 4096 regular file
  14. Device: fd00h/64768d    Inode: 5846 Links: 2
  15. Access: (0664/-rw-rw-r--) Uid: ( 1000/ kobe) Gid: ( 1000/ kobe)
  16. Context: unconfined_u:object_r:user_tmp_t:s0
  17. Access: 2015-10-23 09:32:04.204412959 -0400
  18. Modify: 2015-10-23 09:30:17.986761312 -0400
  19. Change: 2015-10-23 09:31:55.253358045 -0400
  20.  Birth: -
  21. [root@c653f1u25 tmp]# stat 3.txt
  22.   File: ‘3.txt’ -> ‘1.txt’
  23.   Size: 5     Blocks: 0 IO Block: 4096 symbolic link
  24. Device: fd00h/64768d    Inode: 5848 Links: 1
  25. Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
  26. Context: unconfined_u:object_r:user_tmp_t:s0
  27. Access: 2015-10-26 02:35:49.017516496 -0400
  28. Modify: 2015-10-23 09:33:25.094909175 -0400
  29. Change: 2015-10-23 09:33:25.094909175 -0400
  30.  Birth: -
估计这些信息都是来自于这个结构体:

点击(此处)折叠或打开

  1. struct stat {
  2.                dev_t st_dev; /* ID of device containing file */
  3.                ino_t st_ino; /* inode number */
  4.                mode_t st_mode; /* protection */
  5.                nlink_t st_nlink; /* number of hard links */
  6.                uid_t st_uid; /* user ID of owner */
  7.                gid_t st_gid; /* group ID of owner */
  8.                dev_t st_rdev; /* device ID (if special file) */
  9.                off_t st_size; /* total size, in bytes */
  10.                blksize_t st_blksize; /* blocksize for file system I/O */
  11.                blkcnt_t st_blocks; /* number of 512B blocks allocated */
  12.                time_t st_atime; /* time of last access */
  13.                time_t st_mtime; /* time of last modification */
  14.                time_t st_ctime; /* time of last status change */
  15.            }

阅读(1222) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~