The following are some of the more commonly used command line or shell scripts that are extracted during the deployment of OpenStack, for informational purposes only.
1. Kill all existing zombie processes
Ps-ef | grep Defunc | Grep-v grep | awk ' {print $} ' | Xargs Kill-9#pkill DNSMASQ
2. Remove the # sign and blank line from the configuration file
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 \[email protected] filename "&& exit 1grep-v \# \$1 | grep-v ^ $eofcat/root/delsc.shchmod +x/root/delsc.shln-s/ROOT/DELSC.SH/USR/LOCAL/BIN/DELSC
3.CENTOS7 installation Vmtools
# mount/dev/cdrom/mnt/# cp/mnt/vmwaretools-9.4.10-2092844.tar.gz/tmp/# cd/tmp/# tar zxf VMwareTools-9.4.10-2092844.t ar.gz#/tmp/vmware-tools-distrib/vmware-install.plyum Install Open-vm-tools-ysystemctl enable Vmtoolsd.servicesystemctl Start Vmtoolsd.servicesystemctl Status Vmtoolsd.service
4. Modify the Linux system time zone
Mv/etc/localtime/etc/localtime~ln-s/usr/share/zoneinfo/asia/shanghai/etc/localtimechown-h--reference=/etc/ localtime~/etc/localtimechcon-h--reference=/etc/localtime~/etc/localtime
5. List of common time servers in mainland China
Cat >/etc/ntp.conf <<eofserver 2.cn.pool.ntp.org iburstserver 3.asia.pool.ntp.org iburstserver 0. asia.pool.ntp.org iburstrestrict-4 default kod notrap nomodifyrestrict-6 default kod notrap nomodifyeof
6. Configure Time synchronization
Rpm-qa | grep NTP | | Yum install-y ntpntpdate-u pool.ntp.org | | Ntpdate-u Time.nist.gov | | Ntpdate-u time-nw.nist.govdatecat >>/etc/rc.local<<eofntpdate-u pool.ntp.org | | Ntpdate-u Time.nist.gov | | Ntpdate-u time-nw.nist.govhwclock-weof# recommoned Dotouch/etc/cron.daily/ntpdatecat >>/etc/cron.daily/ Ntpdate<<eofntpdate-u pool.ntp.org | | Ntpdate-u Time.nist.gov | | Ntpdate-u time-nw.nist.govhwclock-weof
7. Back up the configuration file before changing the configuration file
Operationfile=/etc/keystone/keystone.confbakoperationfile= $operationfile $ (date +-%f-%h-%m-%s) "~" CP $ Operationfile $bakoperationfilechown-R--reference= $operationfile $bakoperationfilechcon-R--reference=$ Operationfile $bakoperationfile
8. Create a scheduled task
(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
9. Do not switch users but execute commands as this user
Su-s/bin/sh-c "Glance-manage db_sync" glance
10. Get the routed IP
ip=$ (ifconfig ' route | grep default | awk ' {print $8} ' | grep inet | grep-v inet6 | awk ' {print $} ')
11. Determine if the CPU supports virtualization
if [[$ (Egrep-c ' (VMX|SVM) '/proc/cpuinfo) = = 0]];thendefaultnum= ' grep-n "^\[libvirt\]$" $operationfile | Awk-f ': ' {print $} ' sedoperation= $defaultnum "a" sed-i "$sedoperation virt_type = qemu" $operationfileelsedefaultnum = ' Grep-n ' "^\[libvirt\]$" $operationfile | Awk-f ': ' {print $} ' sedoperation= $defaultnum "a" sed-i "$sedoperation virt_type = KVM" $operationfilefi
12. Obtain the IP address corresponding to the specified NIC name
ext_ens=ens160local_ip=$ (ifconfig ' route | grep $ext _ens | awk ' {print $8} ' | grep inet | grep-v inet6 | awk ' {print $} ‘)
End
This article is from "Communication, My Favorites" blog, please make sure to keep this source http://dgd2010.blog.51cto.com/1539422/1584952
12 Linux Systems High-frequency command line and Shell small script