随笔分类 - shell
摘要:脚本如下,后续继续优化 #!/bin/bash #author junxi by #this script is only for CentOS 7.x #check the OS platform=`uname -i` if [ $platform != "x86_64" ];then echo
阅读全文
摘要:crontab -l4 3 * * * tar -czvf /home/backup/nas_`date +%Y%m%d`.tar.gz /data/website/uploadfiles /data/website/media4 4 * * * /bin/find /home/backup -na
阅读全文
摘要:本来直接用crontab -e 就可以打开vim,输入要执行的任务保存退出就可以添加任务直接启动运行了。但是今天组长说能不能写个shell不用打开vi就能添加到crontab的。 最先想到的是怎么在shell脚本里面如何使用vi的命令,网上找了好多,要么格式太乱,要么没明白意思直接告诉vi的使用方法
阅读全文
摘要:#!/bin/bash rm -rf /data/website/activities/virtualenvvirtualenv --no-site-packages -p python3 /data/website/activities/virtualenvsource /data/website
阅读全文
摘要:#!/bin/bash interface1=`ls /sys/class/net|grep en|awk 'NR==1{print}'`interface2=`ls /sys/class/net|grep en|awk 'NR==2{print}'` interface_file1="/etc/s
阅读全文
摘要:#!/bin/bash interface=`ls /sys/class/net|grep en|awk 'NR==1{print}'` if [ ! -e /etc/adserver/.seq.info ];then #生成序列号 #时间 #d=`date +%Y%m%d` mkdir /etc/adserver/ d=`dmidecode -t 0...
阅读全文
摘要:#/bin/bash cd /root/phone echo "update guanwang phone version" git pull if [ $? -ne 0 ]; then echo "update guanwang phone version from git failed" exit 1 fi rsync -avzP --delete ...
阅读全文
摘要:#!/bin/bash #获取参数 while getopts "n:" opt; do case $opt in n) client_name=$OPTARG ;; \?) ;; esac done cd /etc/openvpn/easy-rsa/2.0 sourc...
阅读全文
摘要:#!/bin/bash dir=/etc/openvpn #file=AD00012 basepath=$(cd `dirname $0`; pwd) PACKAGE_DIR="${basepath}/package" if [ -d $dir ];then echo -e "\033[34m 目录已存在.. \033[0m" else mkdir $dir fi #获取...
阅读全文
摘要:#!/bin/bash basepath=$(cd `dirname $0`; pwd)SHELL_DIR="${basepath}/shell"PACKAGE_DIR="${basepath}/package" ##############################install rpm##
阅读全文
摘要:#!/bin/sh echo "Current DIR is " $PWD while [ 1 ] do serverpid=`ps -ef|grep process1|grep -v grep|awk '{print $2}'` serverpid2=`ps -ef|grep process2|grep -v grep|awk '{print $2}'` if [ "$server...
阅读全文
摘要:执行格式: ./set_bridge.sh -i 192.168.4.147 -g 192.168.4.1 -b 192.168.4.255 结果: weifeng@weifeng-ThinkPad-E470:~$ ifconfigbr0 Link encap:以太网 硬件地址 00:0e:c6:d
阅读全文
摘要:执行格式: ./set_bridge.sh -i 192.168.4.72 -g 192.168.4.1 结果: [root@localhost ~]# ifconfigbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192
阅读全文