随笔分类 -  Shell脚本

摘要:#!/bin/sh # # nginx - this script starts and stops the nginx daemin # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processnam... 阅读全文
posted @ 2019-06-26 10:00 梦轻尘 阅读(263) 评论(0) 推荐(0) 编辑
摘要:1、服务器初始化 2、安装编译php依赖的包 3、编译安装mcrypt php编译时候会报mcrypt.h not found,这个库作用就是用来加密的,yum又无法安装,所以就编译安装一个 4、编译安装php-7.1.12 5、修改php配置 6、安装redis模块 去github下载对应的包 h 阅读全文
posted @ 2019-06-21 20:02 梦轻尘 阅读(704) 评论(0) 推荐(0) 编辑
摘要:最近公司发生了蛮多事情的,唉,咱也不管问啊,好好干活吧 需求 把gitlab的备份文件异地备份一份,备份无论失败还是成功通知某邮箱 实现思路 先rsync文件过去,判断rsync这个步骤有没有成功,失败了直接发送备份失败的邮件,成功了的话,再判断源文件和备份的文件的md5值,相等发送备份成功,不相等 阅读全文
posted @ 2019-06-19 23:08 梦轻尘 阅读(601) 评论(0) 推荐(0) 编辑
摘要:for item in `cat 2.txt` do grep $item 1.txt >/tmp/test.txt if [ $? -ne 0 ];then echo "$item" fi done 阅读全文
posted @ 2019-04-30 16:45 梦轻尘 阅读(209) 评论(0) 推荐(0) 编辑
摘要:ls |awk -F . '{print $1}'|awk -F '-[0-9]' '{print $1}' 阅读全文
posted @ 2019-01-11 16:49 梦轻尘 阅读(100) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash #IPaddr=`ifconfig | grep inet\\\\s | grep -v "127.0.0." | sed "s/addr://g"| awk '{print $2}'` check_port() { linenum=$(netstat -tlpn | grep "\b$1\b" | wc -l); echo "$linenum" } f... 阅读全文
posted @ 2018-12-28 21:16 梦轻尘 阅读(266) 评论(0) 推荐(0) 编辑
摘要:##只针对centos7的系统有效,centos6无效,mysql zabbix用户:zabbix,密码:zabbix;建议用全新的centos7服务器 软件版本: (nginx-1.14.2、php-7.2.13、zabbix-4.0.2、mariadb-5.5.60、jdk-1.8.0_131) 阅读全文
posted @ 2018-12-19 16:08 梦轻尘 阅读(1136) 评论(0) 推荐(0) 编辑
摘要:其中test.txt格式如下 /tmp ip地址 阅读全文
posted @ 2018-11-16 10:35 梦轻尘 阅读(2251) 评论(1) 推荐(0) 编辑
摘要:#Jeson #Email:jeson@iaskjob.com #变量定义:access、error日志文件列表 NGINX_LOG=(imoocc_com_access iaskjob_com error) NGINX_ACCESS_PATH=/opt/logs/nginx/access NGINX_ERROR_PATH=/opt/logs/nginx/error #日期变量 Y... 阅读全文
posted @ 2018-07-22 10:23 梦轻尘 阅读(281) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash #Backup Nginx logs Name=`hostname` Log_Path="/logs/nginx" Backup_Path="/data/Backup_Logs/nginx" D=`date -d "yesterday" "+%F"` test -d $Backup_Path/$D || mkdir -p $Backup_Path/$D if [ -... 阅读全文
posted @ 2018-04-22 20:24 梦轻尘 阅读(204) 评论(0) 推荐(0) 编辑
摘要:ping www.baidu.com |awk '{print $0 "\t" strftime("%Y:%m:%d-%H:%M:%S",systime())}'>>baidu.txt 阅读全文
posted @ 2018-04-21 16:01 梦轻尘 阅读(385) 评论(0) 推荐(0) 编辑
摘要:上午大学同学问了我一个脚本的问题,大概需求就是看到所有端口的开启情况,还要知道每个端口的应用程序路径,而且要和之前的数据齐平,就是再加一列数据。我腚眼一看,非常容易嘛,但由于当时忙,所以就说中午给他发过去,但到自己写的时候,各种问题啊,awk的用法找了又找,不得不说awk非常伟大,脚本如下: sho 阅读全文
posted @ 2017-07-19 15:07 梦轻尘 阅读(4200) 评论(0) 推荐(0) 编辑
摘要:服务器环境: 脚本如下: 温馨提示:版本库路径为/home/svndata ,权限配置文件路径为/etc/subversion/svn_authz.conf,subversion配置文件所在路径为/etc/httpd/conf.d。 阅读全文
posted @ 2017-05-27 18:17 梦轻尘 阅读(1101) 评论(0) 推荐(1) 编辑
摘要:svn版本库备份 官方建议使用如下方法备份(全备) svnadmin hotcopy path/to/repository path/to/backup 链接:https://tortoisesvn.net/docs/release/TortoiseSVN_zh_CN/tsvn-repository-backup.html 备份脚本 #!/bin/bash #版本库目录路径 SOUR_SVN=... 阅读全文
posted @ 2017-05-17 23:14 梦轻尘 阅读(230) 评论(0) 推荐(0) 编辑
摘要:配置文件scp.conf except免秘钥脚本 scp分发脚本 记录下,怕以后找不到了 阅读全文
posted @ 2017-01-13 18:42 梦轻尘 阅读(1776) 评论(1) 推荐(0) 编辑
摘要:今天被shell脚本的单双引号搞晕了,一般来说单双引号是没有问题的,但如果引号里面套引号就要引起注意了,今天被这个坑的好惨,记录下: 阅读全文
posted @ 2016-12-27 13:56 梦轻尘 阅读(285) 评论(0) 推荐(0) 编辑
摘要:今天线上服务器全部升级python环境为python-2.7.6的环境,我采用的方法是ansible+shell,代码如下,友提,Python-2.7.6.tgz、setuptools-14.3.1.tar.gz、pip-9.0.1.tar.gz,这三个包我是提前下好放在/data/x5online 阅读全文
posted @ 2016-12-20 18:16 梦轻尘 阅读(296) 评论(0) 推荐(0) 编辑
摘要:其中remote_cmd改成你想执行的命令,其中控制机和被执行命令的机器做了免秘钥登录 阅读全文
posted @ 2016-12-20 11:42 梦轻尘 阅读(509) 评论(0) 推荐(0) 编辑
摘要:转载:https://github.com/roncoo/roncoo-cmdb/blob/master/devops/install/cobbler.sh 阅读全文
posted @ 2016-12-17 00:29 梦轻尘 阅读(613) 评论(0) 推荐(0) 编辑
摘要:偶尔需要用到,暂且放到博客上,防止要用的时候找不到。。。。 阅读全文
posted @ 2016-12-06 11:52 梦轻尘 阅读(348) 评论(0) 推荐(0) 编辑

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