• 将redis添加到linux系统服务


    (1)

    [root@xiaofeibao ~]# find / -name redis
    /etc/redis
    /etc/logrotate.d/redis
    /etc/rc.d/init.d/redis
    /swoole-1.9.6/examples/redis
    /var/log/redis
    /var/run/redis
    /var/lib/redis

    (2)参考链接

    http://blog.csdn.net/justfor3l/article/details/53187795

    (3)

    [root@xiaofeibao ~]# vim /etc/rc.d/init.d/redis

    #!/bin/sh
    #
    # redis init file for starting up the redis daemon
    #
    # chkconfig: - 20 80
    # description: Starts and stops the redis daemon.

    # Source function library.
    . /etc/rc.d/init.d/functions

    name="redis-server"
    exec="/usr/sbin/$name"
    pidfile="/var/run/redis/redis.pid"
    REDIS_CONFIG="/etc/redis.conf"

    [ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis

    lockfile=/var/lock/subsys/redis

    start() {
    [ -f $REDIS_CONFIG ] || exit 6
    [ -x $exec ] || exit 5
    echo -n $"Starting $name: "
    daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG"
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
    }

    stop() {
    echo -n $"Stopping $name: "
    killproc -p $pidfile $name
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
    }

    restart() {
    stop
    start
    }

    reload() {
    false
    }

    rh_status() {
    status -p $pidfile $name
    }

    "/etc/rc.d/init.d/redis" 88L, 1490C

  • 相关阅读:
    .NET基础——数组
    .NET基础——循环、枚举
    .NET基础——运算符
    .NET基础——基本概念
    面向对象基础——结构体
    面向对象基础——静态成员、静态类
    面向对象基础——基本概念
    接口 与 抽象类
    委托与事件——事件
    委托与事件——委托
  • 原文地址:https://www.cnblogs.com/choucat/p/7472157.html
Copyright © 2020-2023  润新知