Memcached进程挂掉自动重启脚本
vim memcached_check.sh
#!/bin/sh
#check memcached process and restart if down
PATH=$PATH:/opt/env/memcache/bin/memcached
DATE=`date -d "today" +"%Y-%m-%d-%H:%M"`
#用ps命令查看memcached进程
MM=`ps -aux |grep "memcached" |grep "11211" |grep -v "grep" |wc -l`
#if语句判断进程是否存在,如果不存在,输出日志记录并重启memcached服务
if [ "$MM" == "0" ]; then
echo "$DATE The memcached is problem and restart" >> /root/sh/memcached_check.logs
/opt/env/memcache/bin/memcached -t 8 -d -m 2048 -p 11211 -u nobody
else
#echo "$DATE The memcached is ok" >>/root/sh/memcached_check.logs
fi
添加计划任务,每5分钟检测一次。
*/5 * * * * /bin/bash /root/sh/memcached_check.sh
文章来源:刘俊涛的博客
地址:http://www.cnblogs.com/lovebing
欢迎关注,有问题一起学习欢迎留言、评论。
Memcached进程挂掉自动重启脚本的更多相关文章
- linux服务器挂掉自动重启脚本(转)
实现原理主要是使用linux提供的crontab机制,定时查询服务器进程是否存在,如果宕机则执行我们预设的重启脚本. 首先我们要向crontab加入一个新任务 sudo crontab -e #进入编 ...
- tomcat宕机自动重启脚本
#!/bin/bash# 获取tomcat进程ID /usr/share/tomcatTomcatID=$(ps -ef |grep tomcat |grep -w 'tomcat'|grep -v ...
- OGG 自动重启脚本
6-20 * * * /oggdata/log/oggautorestart.sh >/oggdata/log/crontab_oggautorestart.log 2>&1 [说 ...
- linux kafka进程挂了 自动重启
使用crontab,定时监控 kafka进程,发现挂了后重启. shell脚本如下: #!/bin/sh source /etc/profile proc_dir="/data/kafka& ...
- php-fpm进程关闭与重启脚本详解(转)
先来理解一下什么是php-fpm PHP-FPM是一个PHP FastCGI管理器,是只用于PHP的. PHP-FPM其实是PHP源代码的一个补丁,旨在将FastCGI进程管理整合进PHP包中.必须将 ...
- php-fpm进程关闭与重启脚本详解
先来理解一下什么是php-fpm PHP-FPM是一个PHP FastCGI管理器,是只用于PHP的. PHP-FPM其实是PHP源代码的一个补丁,旨在将FastCGI进程管理整合进PHP包中.必须将 ...
- zabbix 监控redis 挂掉自动重启 并发送企业微信
1.创建redis监控项[配置]-[主机]-[监控项]-创建监控项,监控6379端口(注意关闭防火墙或者开启防火墙端口6379) redis配置文件设置允许任何地址监听: 添加监控项 2.创建redi ...
- window程序意外关闭自动重启脚本实现
@echo off : tasklist|find /i "xxxx"||start yyyy ping/n 127.1>nul 新建 .bat 文件,将其写入文件 xxxx ...
- supervisor开机自动启动脚本+redis+MySQL+tomcat+nginx进程自动重启配置
[root@mongodb-host supervisord]# cat mongo.conf [program:mongo]command=/usr/local/mongodb/bin/mongod ...
随机推荐
- python Error Message: command 'gcc' failed with exit status 1
参考:[ CSDN ] 解决方法 yum install gcc libffi-devel python-devel openssl-devel
- 自以为是而已,不知道它是什么 window.onload 放执行
var $=jQuery=function(onload){window.onload=onload();} jQuery(function(){alert(2);}); $(function(){a ...
- centos 下文件夹共享
[root@localhost share]# yum install samba -y[root@localhost share]# cp /etc/samba/smb.conf /etc/samb ...
- scandir函数详解
scandir函数详解2009-10-30 10:51scandir函数:读取特定的目录数据表头文件:#include <dirent.h>定义函数:int scandir(const c ...
- Flex接收51单片机发送过来的16进制数据转换为String
private static function toHex(bytes:ByteArray):String{ var pos:int =bytes.position; bytes.position=0 ...
- J.U.C并发框架源码阅读(十六)FutureTask
基于版本jdk1.7.0_80 java.util.concurrent.FutureTask 代码如下 /* * ORACLE PROPRIETARY/CONFIDENTIAL. Use is su ...
- (1)C#工具箱-公共控件1
公共控件 InitializeComponent() 先说下InitializeComponent()这个方法,它在form1.cs里调用这个方法对控件进行初始化,控件的方法要在这个方法之后,否则会因 ...
- kuangbin系列【简单搜索】
poj-1321棋盘问题[bfs/回溯] Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36385 Accepted: ...
- 51nod 1133 不重叠的线段【贪心/区间覆盖】
1133 不重叠的线段 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 X轴上有N条线段,每条线段有1个起点S和终点E.最多能够选出多少条互不重叠的 ...
- 2017 ACM-ICPC Asia Xi'an Problem A XOR(异或线性基 )
题目链接 2017西安赛区 Problem A 题意 给定一个数列,和$q$个询问,每个询问中我们可以在区间$[L, R]$中选出一些数. 假设我们选出来的这个数列为$A[i_{1}]$, $A[ ...