原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://dgd2010.blog.51cto.com/1539422/1661362
-
欢迎信息,一般包括Linux发行版本名称,内核版本、操作系统位数
-
操作系统当前信息,如操作系统负载,进程数量,文件系统使用情况,当前用户登录数,内存(含swap)使用情况,IP地址
-
文档和帮助信息
-
可更新的软件包和可升级的安全补丁
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#Long running operations (such as network calls) or resource intensive scripts should cache output, and only update that output if it is deemed expired. For instance:
#/etc/update-motd.d/50-news
#!/bin/sh
out=
/var/run/foo
script=
"w3m -dump http://news.google.com/"
if
[ -f
"$out"
];
then
# Output exists, print it
echo
cat
"$out"
# See if it's expired, and background update
lastrun=$(stat -c %Y
"$out"
) || lastrun=0
expiration=$(
expr
$lastrun + 86400)
if
[ $(
date
+%s) -
ge
$expiration ];
then
$script >
"$out"
&
fi
else
# No cache at all, so update in the background
$script >
"$out"
&
fi
#Scripts should emit a blank line before output, and end with a newline character. For instance:
#/etc/update-motd/05-lsb-release
#!/bin/sh
echo
lsb-release -a
|