原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://dgd2010.blog.51cto.com/1539422/1584952
1
2
|
ps
-ef |
grep
defunc |
grep
-
v
grep
|
awk
'{print $3}'
|
xargs
kill
-9
#pkill dnsmasq
|
1
2
3
4
5
6
7
8
9
|
cat
>
/root/delsc
.sh <<eof
#!/bin/bash
# delete all spaces and comments of specialized file, using with filename
[[
"\$1"
==
''
]] &&
echo
"delete all spaces and comments of specialized file, using with \$@ filename"
&&
exit
1
grep
-
v
\
# \$1 | grep -v ^$
eof
cat
/root/delsc
.sh
chmod
+x
/root/delsc
.sh
ln
-s
/root/delsc
.sh
/usr/local/bin/delsc
|
1
2
3
4
5
6
7
8
9
|
# mount /dev/cdrom /mnt/
# cp /mnt/VMwareTools-9.4.10-2092844.tar.gz /tmp/
# cd /tmp/
# tar zxf VMwareTools-9.4.10-2092844.tar.gz
# /tmp/vmware-tools-distrib/vmware-install.pl
yum
install
open
-vm-tools -y
systemctl
enable
vmtoolsd.service
systemctl start vmtoolsd.service
systemctl status vmtoolsd.service
|
1
2
3
4
|
mv
/etc/localtime
/etc/localtime
~
ln
-s
/usr/share/zoneinfo/Asia/Shanghai
/etc/localtime
chown
-h --reference=
/etc/localtime
~
/etc/localtime
chcon -h --reference=
/etc/localtime
~
/etc/localtime
|
1
2
3
4
5
6
7
|
cat
>
/etc/ntp
.conf <<eof
server 2.cn.pool.ntp.org iburst
server 3.asia.pool.ntp.org iburst
server 0.asia.pool.ntp.org iburst
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
eof
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
rpm -qa |
grep
ntp || yum
install
-y ntp
ntpdate -u pool.ntp.org || ntpdate -u
time
.nist.gov || ntpdate -u
time
-nw.nist.gov
date
cat
>>
/etc/rc
.
local
<<EOF
ntpdate -u pool.ntp.org || ntpdate -u
time
.nist.gov || ntpdate -u
time
-nw.nist.gov
hwclock -w
EOF
# Recommoned do
touch
/etc/cron
.daily
/ntpdate
cat
>>
/etc/cron
.daily
/ntpdate
<<EOF
ntpdate -u pool.ntp.org || ntpdate -u
time
.nist.gov || ntpdate -u
time
-nw.nist.gov
hwclock -w
EOF
|
1
2
3
4
5
|
operationfile=
/etc/keystone/keystone
.conf
bakoperationfile=$operationfile$(
date
+-%F-%H-%M-%S)
"~"
cp
$operationfile $bakoperationfile
chown
-R --reference=$operationfile $bakoperationfile
chcon -R --reference=$operationfile $bakoperationfile
|
1
|
(
crontab
-l -u keystone 2>&1 |
grep
-q token_flush) ||
echo
'@hourly /usr/bin/keystone-manage token_flush >/var/log/keystone/keystone-tokenflush.log 2>&1'
>>
/var/spool/cron/keystone
|
1
|
su
-s
/bin/sh
-c
"glance-manage db_sync"
glance
|
1
|
ip=$(
ifconfig
`route |
grep
default |
awk
'{print $8}'
` |
grep
inet |
grep
-
v
inet6 |
awk
'{print $2}'
)
|
1
2
3
4
5
6
7
8
9
|
if
[[ $(
egrep
-c
'(vmx|svm)'
/proc/cpuinfo
) == 0 ]];
then
defaultnum=`
grep
-n
"^\[libvirt\]$"
$operationfile |
awk
-F
':'
'{print $1}'
`
sedoperation=$defaultnum
"a"
sed
-i
"$sedoperation virt_type = qemu"
$operationfile
else
defaultnum=`
grep
-n
"^\[libvirt\]$"
$operationfile |
awk
-F
':'
'{print $1}'
`
sedoperation=$defaultnum
"a"
sed
-i
"$sedoperation virt_type = kvm"
$operationfile
fi
|
1
2
|
ext_ens=ens160
local_ip=$(
ifconfig
`route |
grep
$ext_ens |
awk
'{print $8}'
` |
grep
inet |
grep
-
v
inet6 |
awk
'{print $2}'
)
|
1
|
find
/tmp
-name core -
type
f -print0 |
xargs
-0
/bin/rm
-f
|
1
|
find
. -
type
f -
exec
file
'{}'
\;
|
1
|
find
/ -size +1000M -
exec
ls
-alh
'{}'
\;
|
1
|
time
dd
if
=
/dev/zero
of=
/tmp/testfile
bs=4k count=80000
|