crontab 修改

crontab -e 还可以先修改到一个文件中,再进行加载 echo ’55 23 * * * user killall -9 java’ >> /etc/crontab echo ’56 23 * * * user /home/user/Resin/bin/startresin.sh’ >> /etc/crontab #会覆盖掉原来的数据,慎用 crontab /etc/crontab    SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .—————- minute (0 – 59) # | .————- hour (0 … Read more

nginx 可视化监控

从理论到案例,请收下这篇Nginx监控运维干货 http://blog.itpub.net/31557889/viewspace-2285311/ ELK + Grafana 来分析nginx日志 打造可视化监控 https://blog.csdn.net/qq_25934401/article/details/83345144 利用 ELK系统分析Nginx日志并对数据进行可视化展示 https://www.cnblogs.com/hanyifeng/p/5857875.html Centos7 之安装Logstash ELK stack 日志管理系统 https://www.cnblogs.com/hanyifeng/p/5509985.html   效果图:

tar 压缩 解压 文件 文件夹

解压缩 tar -zxvf nginx-1.14.1.tar.gz 压缩(目录) tar -zcvf /data/back/backup.tar.gz /data 压缩(文件) tar -czvf 11.tar.gz *.log –remove-files   参数: -c :create 建立压缩档案的参数; -x : 解压缩压缩档案的参数; -z : 是否需要用gzip压缩; -v: 压缩的过程中显示档案; -f: 置顶文档名,在f后面立即接文件名,不能再加参数    

cutnginxlog.sh -Nginx 日志文件切割和定时执行 截取 截断

#!/bin/sh # Program: # Auto cut nginx log script. # nginx日志路径 LOGS_PATH=/usr/local/nginx/logs TODAY=$(date -d ‘today’ +%Y-%m-%d) # 移动日志并改名 mv ${LOGS_PATH}/error.log ${LOGS_PATH}/error_${TODAY}.log mv ${LOGS_PATH}/access.log ${LOGS_PATH}/access_${TODAY}.log #zip -m ${LOGS_PATH}/error_${TODAY}.log.zip ${LOGS_PATH}/error_${TODAY}.log #zip -m ${LOGS_PATH}/access_${TODAY}.log.zip ${LOGS_PATH}/access_${TODAY}.log tar -czf ${LOGS_PATH}/error_${TODAY}.log.tar.gz ${LOGS_PATH}/error_${TODAY}.log –remove-files tar -czf ${LOGS_PATH}/access_${TODAY}.log.tar.gz ${LOGS_PATH}/access_${TODAY}.log –remove-files # 向nginx主进程发送重新打开日志文件的信号 kill -USR1 $(cat /usr/local/nginx/logs/nginx.pid) #echo ‘0 0 * * * root … Read more

RHEL8/CentOS8 防火墙配置

systemctl systemctl unmask firewalld #执行命令,即可实现取消服务的锁定 systemctl mask firewalld # 下次需要锁定该服务时执行 systemctl start firewalld.service #启动防火墙 systemctl stop firewalld.service #停止防火墙 systemctl reloadt firewalld.service #重载配置 systemctl restart firewalld.service #重启服务 systemctl status firewalld.service #显示服务的状态 systemctl enable firewalld.service #在开机时启用服务 systemctl disable firewalld.service #在开机时禁用服务 systemctl is-enabled firewalld.service #查看服务是否开机启动 systemctl list-unit-files|grep enabled #查看已启动的服务列表 systemctl –failed #查看启动失败的服务列表 firewall-cmd firewall-cmd –state #查看防火墙状态 firewall-cmd –reload … Read more

linux下邮件查看命令

安装mail $ yum install mailx   $mail & 2 //显示标号为2的文件 $ h //显示当前的邮件列表 $d //删除   系统提供了用户之间通信的邮件系统,当用户打开终端注册登录时发现系统给出如下信息: you have mail. 这时用户可通过键入mail命令读取信件: $ mail mail程序将逐个显示用户的信件,并依照时间顺序,显示最新的信件。每显示一段信件,mail都询问 用户是否要对该信件作些处理。若用户回答d,则表示删除信件;若仅按回车键,表示对信件不作任何改 动(信件仍旧保存,下次还可读这一信件);若回答p,则要求重复显示信件;s filename表示要把信件 存入所命名的文件;若回答q,表示要从mail退出。   [root@localhost ~]# mail Mail version 8.1 6/6/93. Type ? for help. “/var/spool/mail/root”: 76 messages 76 unread >U 1 root@localhost.local Mon Jan 19 15:43 24/936 “Cron <root@localhost>” … Read more

Nginx 配置

#user nobody; worker_processes 4; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; worker_rlimit_nofile 65535; events { use epoll; worker_connections 10024; } http { #include /usr/local/nginx/conf/proxy.conf; #include /usr/local/nginx/conf/vhosts/www.test.com.conf; include mime.types; default_type application/octet-stream; #log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘ # ‘$status $body_bytes_sent “$http_referer” ‘ # ‘”$http_user_agent” “$http_x_forwarded_for”‘; #access_log logs/access.log main; sendfile on; #tcp_nopush … Read more