我正在尝试确定补丁程序级别以及某些Solaris计算机没有进行修补的时间,以便支持首先对哪些系统进行修补。 我如何确定Solaris机器上次修补的时间?
那么,不知道任何好的直接方式,但这些可能会有所帮助。 'showrev -p'会告诉你所有已安装的补丁。 我猜测/ var / sadm / pkg中的date是从上次修改(或打补丁)软件包开始的。
我不知道最后一次安装solaris盒子的时间,但是你可以用showrev -p
我会同意上面的showrev -p注释,并添加uname -a来获取内核版本也是有用的给一个总的图片。
您应该首先检查显示哪个版本的Solaris最初安装的/ etc / release,然后检查'uname -a'您正在使用哪个内核修补程序(显示的是XXXXXX-XX),然后开始比较内核修补程序与其他机器一样,内核补丁是一个关键组件,所以更新的内核补丁通常意味着在几乎所有方面都是更新的系统。
然后,如果您不是心灰意冷,只需提供有效的SunSolve帐户,就可以使用(非官方) PCA工具自动更新您的系统。
要确定Solaris(10)系统在没有修补的情况下已经运行了多久,我需要远程检查以下内容(从Linux系统开始,因为GNU date
很方便)。
1)从patch
目录中最近的东西中远程获取date/时间;
(请参阅下面的ls
选项的解释)
ls -terd /var/sadm/patch/* | tail -1 | awk '{print $6,$7,$9,$8 }'
注意; awk
命令以MMM DD YYYY HH:mm:ss
格式打印date;
Jan 28 2017 01:48:14
2)用days_since{}
计算$days_since
(这个工作在ksh
,可能在bash
);
function days_since { d2=$(date -d "$1" +%s) d1=$(date -d now +%s) echo $(( (d1 - d2) / 86400 )) }
现在我们知道Solaris 10系统在192天内还没有被修补! 🙂
Solaris 10 ls
命令的快速参考;
-t Sorts by time stamp (latest first) instead of by name. The default is the last modification time. (See -u and -c. -e The same as -l, except displays time to the second, and with one format for all files regardless of age: mmm dd hh:mm:ss yyyy. -r Reverses the order of sort to get reverse alphabetic or oldest first as appropriate. -d If an argument is a directory, lists only its name (not its contents). Often used with -l to get the status of a directory.