随笔分类 -  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 阅读全文
posted @ 2018-01-27 13:15 Oops!# 阅读(268) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-01-26 17:05 Oops!# 阅读(525) 评论(0) 推荐(0) 编辑
摘要:本来直接用crontab -e 就可以打开vim,输入要执行的任务保存退出就可以添加任务直接启动运行了。但是今天组长说能不能写个shell不用打开vi就能添加到crontab的。 最先想到的是怎么在shell脚本里面如何使用vi的命令,网上找了好多,要么格式太乱,要么没明白意思直接告诉vi的使用方法 阅读全文
posted @ 2018-01-22 17:45 Oops!# 阅读(15154) 评论(0) 推荐(2) 编辑
摘要:#!/bin/bash rm -rf /data/website/activities/virtualenvvirtualenv --no-site-packages -p python3 /data/website/activities/virtualenvsource /data/website 阅读全文
posted @ 2018-01-20 13:44 Oops!# 阅读(1159) 评论(0) 推荐(0) 编辑
摘要:#!/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 阅读全文
posted @ 2018-01-19 09:46 Oops!# 阅读(1075) 评论(0) 推荐(0) 编辑
摘要:#!/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... 阅读全文
posted @ 2017-11-10 15:39 Oops!# 阅读(750) 评论(0) 推荐(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 ... 阅读全文
posted @ 2017-11-09 15:48 Oops!# 阅读(697) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash #获取参数 while getopts "n:" opt; do case $opt in n) client_name=$OPTARG ;; \?) ;; esac done cd /etc/openvpn/easy-rsa/2.0 sourc... 阅读全文
posted @ 2017-11-08 12:00 Oops!# 阅读(280) 评论(0) 推荐(0) 编辑
摘要:#!/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 #获取... 阅读全文
posted @ 2017-11-08 11:58 Oops!# 阅读(2208) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash basepath=$(cd `dirname $0`; pwd)SHELL_DIR="${basepath}/shell"PACKAGE_DIR="${basepath}/package" ##############################install rpm## 阅读全文
posted @ 2017-10-20 16:19 Oops!# 阅读(337) 评论(0) 推荐(0) 编辑
摘要:#!/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... 阅读全文
posted @ 2017-10-12 09:33 Oops!# 阅读(666) 评论(0) 推荐(0) 编辑
摘要:执行格式: ./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 阅读全文
posted @ 2017-10-10 15:25 Oops!# 阅读(630) 评论(0) 推荐(0) 编辑
摘要:执行格式: ./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 阅读全文
posted @ 2017-09-19 08:57 Oops!# 阅读(1212) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示