分享Memcached shell启动停止脚本
注意:要使用这个shell,必须先成功建立memcache环境
1》建立memcached文件和权限
[root@luozhonghua ~]# touch /etc/init.d/memcached
[root@luozhonghua ~]# chmod +x /etc/init.d/memcached
2》编写Memcached shell管理脚本 vi /etc/init.d/memcached
#!/bin/bash
# memcached - This shell script takes care of starting and stopping memcached.
#
# chkconfig: - 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached memcached_path="/usr/local/bin/memcached"
memcached_pid="/var/run/memcached.pid"
memcached_memory="1024" # Source function library.
. /etc/rc.d/init.d/functions [ -x $memcached_path ] || exit 0 RETVAL=0
prog="memcached" # Start daemons.
start() {
if [ -e $memcached_pid -a ! -z $memcached_pid ];then
echo $prog" already running...."
exit 1
fi echo -n $"Starting $prog "
# Single instance for all caches
$memcached_path -m $memcached_memory -l 0.0.0.0 -p 11211 -u root -d -P $memcached_pid
RETVAL=$? [ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
return $RETVAL
} # Stop daemons.
stop() {
echo -n $"Stopping $prog "
killproc -d 10 $memcached_path
echo
[ $RETVAL = 0 ] && rm -f $memcached_pid /var/lock/subsys/$prog RETVAL=$? return $RETVAL
} # See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$? ;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit $RETVAL
##############本脚本中的以下二个配置可依据实际而配置############
#memcached_path="/usr/local/bin/memcached"
#memcached_memory="1024" 3》 追究该脚本为系统服务
chkconfig --add memcached
chkconfig memcached on
4》測试(试试手啊)
<p>service memcached start|stop|status|restart </p>
分享Memcached shell启动停止脚本的更多相关文章
- Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- Linux Oracle服务启动&停止脚本与开机自启动[转]
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- 【转】Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设置相关参数,首先先介 ...
- redis 启动停止脚本
redis 启动停止脚本,该redis需要密码登录,如没有密码,去掉stop函数里的 -a #!/bin/sh # #chkconfig: 2345 80 90 # Simple Redis init ...
- (转)Linux Oracle服务启动&停止脚本与开机自启动
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介 ...
- SpringBoot项目快速启动停止脚本
SpringBoot项目快速启动停止脚本 1.在jar包同级目录下,创建 app.sh #!/bin/bash appName=`ls|grep .jar$` if [ -z $appName ] t ...
- win nginx + php bat启动/停止脚本
启动脚本 @echo offREM Windows 下无效REM set PHP_FCGI_CHILDREN=5 REM 每个进程处理的最大请求数,或设置为 Windows 环境变量set PHP_F ...
- Bash Shell启动配置脚本的顺序
1.Bash检查环境变量文件的方式,取决于系统运行Shell的方式,通常系统运行Shell有3种方式: )通过系统用户登陆后默认运行的Shell )非登陆交互式运行Shell )执行脚本运行非交互式S ...
- 微服务linux启动停止脚本
# 停止脚本#!/bin/bash #其他服务停止脚步可以通过修改APP_MAIN参数即可 APP_MAIN=com.idoipo.infras.eureka.center.Application t ...
随机推荐
- 拼接多个 wchar_t *
/* wcscat example */ #include <wchar.h> int main () { wchar_t wcs[80]; wcscpy (wcs,L" ...
- Linux:su和su-的区别
大部分Linux发行版的默认账户是普通用户,而更改系统文件或者执行某些命令,需要root身份才能进行,这就需要从当前用户切换到root用户.Linux中切换用户的命令是su或su -. 如上图所示,一 ...
- php 内置函数JSON处理
一:生成json数据 <?php $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); echo json_enco ...
- 调整UIPickerView高度
Advantages: Makes setFrame of UIPickerView behave like it should No transform code within your UIVie ...
- UITableViewCell 取消分隔线
方法一: [historyTodayTableVC setSeparatorStyle:UITableViewCellSeparatorStyleNone]; 方法二: [historyTodayTa ...
- 常用工具软件之串口终端工具——SecureCRT和xshell
SecureCRT是一款支持SSH(SSH1和SSH2)的终端仿真程序,简单的说是Windows下登录UNIX或Linux服务器主机的软件.SecureCRT支持SSH,同时支持Telnet和rlog ...
- 【java读书笔记】JSTL,高速精通
JSTL并非什么新颖的技术并且非常easy,甚至有人觉得JSTL已经过时了.可是我觉得它既然存在,就有存在的道理.作为技术人员就应该知道它们是什么,怎么使用,有什么长处. JSTL包括两部分:标签库和 ...
- java格式化百分比
NumberFormat nf = NumberFormat.getPercentInstance(); System.out.println(nf.format(0.47)); 显示:47% Dec ...
- linux bash Shell特殊变量:Shell $0, $#, $*, $@, $?, $$和命令行参数
在linux下配置shell参数说明 前面已经讲到,变量名只能包含数字.字母和下划线,因为某些包含其他字符的变量有特殊含义,这样的变量被称为特殊变量. 例如,$ 表示当前Shell进程的ID,即pid ...
- java stream collector
Java Stream API进阶篇 本文github地址 上一节介绍了部分Stream常见接口方法,理解起来并不困难,但Stream的用法不止于此,本节我们将仍然以Stream为例,介绍流的规约操作 ...