Make redis service (init file) manageable by userRedis as service on CentOs6How to restart docker containers(in specific order) automatically on every reboot in Ubuntu 14.04How to install redis 3.0.7 on Debian 8systemd and OpenVPN woes after an Ubuntu upgradeCannot install redis serversystemd: finish the execution of custom shell script before starting nginxUpstart script with expect scriptingvncserver blank display — debian 9 guest VM w/ubuntu 16 hostredis hvals: get return as array structureHow to enable redis service in Ubuntu 14.04

Is exact Kanji stroke length important?

Customer Requests (Sometimes) Drive Me Bonkers!

Why not increase contact surface when reentering the atmosphere?

How does Loki do this?

How can we prove that any integral in the set of non-elementary integrals cannot be expressed in the form of elementary functions?

Class Action - which options I have?

How does it work when somebody invests in my business?

What is the difference between "behavior" and "behaviour"?

What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?

Risk of infection at the gym?

How can I kill an app using Terminal?

Do sorcerers' subtle spells require a skill check to be unseen?

What happens if you roll doubles 3 times then land on "Go to jail?"

Is expanding the research of a group into machine learning as a PhD student risky?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Integer addition + constant, is it a group?

Unreliable Magic - Is it worth it?

Proof of work - lottery approach

How long to clear the 'suck zone' of a turbofan after start is initiated?

How do we know the LHC results are robust?

Is HostGator storing my password in plaintext?

How do I extract a value from a time formatted value in excel?

How to check is there any negative term in a large list?

How did Arya survive the stabbing?



Make redis service (init file) manageable by user


Redis as service on CentOs6How to restart docker containers(in specific order) automatically on every reboot in Ubuntu 14.04How to install redis 3.0.7 on Debian 8systemd and OpenVPN woes after an Ubuntu upgradeCannot install redis serversystemd: finish the execution of custom shell script before starting nginxUpstart script with expect scriptingvncserver blank display — debian 9 guest VM w/ubuntu 16 hostredis hvals: get return as array structureHow to enable redis service in Ubuntu 14.04













0















Below is my redis init file:



#!/bin/sh
. /lib/lsb/init-functions


EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli

PIDFILE=/var/run/redis.pid
CONF="/etc/redis/redis.conf"


redis_start()

if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi



redis_stop()


if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC shutdown
while [ -x /proc/$PID ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi





case "$1" in
start)
redis_start
;;
stop)
redis_stop
;;
restart)
redis_stop
redis_start
;;
status)
status -p $PIDFILE redis
script_result=$?
;;
*)
echo "Please use start, stop, restart or status as first argument"
;;
esac
exit 0


I have to make this service managed by redis user. It is relatively easy to do in redis.service file:



[Unit]
Description=Redis In-Memory Data Store
After=network.target

[Service]
User= redis_user
Group= redis_group
ExecStart=/usr/local/bin/redis-server redis_conf_dir /redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target


But I don't know what arguments to pass and where to pass them in init file to make service manageable by redis user.










share|improve this question









New contributor




atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0















    Below is my redis init file:



    #!/bin/sh
    . /lib/lsb/init-functions


    EXEC=/usr/local/bin/redis-server
    CLIEXEC=/usr/local/bin/redis-cli

    PIDFILE=/var/run/redis.pid
    CONF="/etc/redis/redis.conf"


    redis_start()

    if [ -f $PIDFILE ]
    then
    echo "$PIDFILE exists, process is already running or crashed"
    else
    echo "Starting Redis server..."
    $EXEC $CONF
    fi



    redis_stop()


    if [ ! -f $PIDFILE ]
    then
    echo "$PIDFILE does not exist, process is not running"
    else
    PID=$(cat $PIDFILE)
    echo "Stopping ..."
    $CLIEXEC shutdown
    while [ -x /proc/$PID ]
    do
    echo "Waiting for Redis to shutdown ..."
    sleep 1
    done
    echo "Redis stopped"
    fi





    case "$1" in
    start)
    redis_start
    ;;
    stop)
    redis_stop
    ;;
    restart)
    redis_stop
    redis_start
    ;;
    status)
    status -p $PIDFILE redis
    script_result=$?
    ;;
    *)
    echo "Please use start, stop, restart or status as first argument"
    ;;
    esac
    exit 0


    I have to make this service managed by redis user. It is relatively easy to do in redis.service file:



    [Unit]
    Description=Redis In-Memory Data Store
    After=network.target

    [Service]
    User= redis_user
    Group= redis_group
    ExecStart=/usr/local/bin/redis-server redis_conf_dir /redis.conf
    ExecStop=/usr/local/bin/redis-cli shutdown
    Restart=always

    [Install]
    WantedBy=multi-user.target


    But I don't know what arguments to pass and where to pass them in init file to make service manageable by redis user.










    share|improve this question









    New contributor




    atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      Below is my redis init file:



      #!/bin/sh
      . /lib/lsb/init-functions


      EXEC=/usr/local/bin/redis-server
      CLIEXEC=/usr/local/bin/redis-cli

      PIDFILE=/var/run/redis.pid
      CONF="/etc/redis/redis.conf"


      redis_start()

      if [ -f $PIDFILE ]
      then
      echo "$PIDFILE exists, process is already running or crashed"
      else
      echo "Starting Redis server..."
      $EXEC $CONF
      fi



      redis_stop()


      if [ ! -f $PIDFILE ]
      then
      echo "$PIDFILE does not exist, process is not running"
      else
      PID=$(cat $PIDFILE)
      echo "Stopping ..."
      $CLIEXEC shutdown
      while [ -x /proc/$PID ]
      do
      echo "Waiting for Redis to shutdown ..."
      sleep 1
      done
      echo "Redis stopped"
      fi





      case "$1" in
      start)
      redis_start
      ;;
      stop)
      redis_stop
      ;;
      restart)
      redis_stop
      redis_start
      ;;
      status)
      status -p $PIDFILE redis
      script_result=$?
      ;;
      *)
      echo "Please use start, stop, restart or status as first argument"
      ;;
      esac
      exit 0


      I have to make this service managed by redis user. It is relatively easy to do in redis.service file:



      [Unit]
      Description=Redis In-Memory Data Store
      After=network.target

      [Service]
      User= redis_user
      Group= redis_group
      ExecStart=/usr/local/bin/redis-server redis_conf_dir /redis.conf
      ExecStop=/usr/local/bin/redis-cli shutdown
      Restart=always

      [Install]
      WantedBy=multi-user.target


      But I don't know what arguments to pass and where to pass them in init file to make service manageable by redis user.










      share|improve this question









      New contributor




      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      Below is my redis init file:



      #!/bin/sh
      . /lib/lsb/init-functions


      EXEC=/usr/local/bin/redis-server
      CLIEXEC=/usr/local/bin/redis-cli

      PIDFILE=/var/run/redis.pid
      CONF="/etc/redis/redis.conf"


      redis_start()

      if [ -f $PIDFILE ]
      then
      echo "$PIDFILE exists, process is already running or crashed"
      else
      echo "Starting Redis server..."
      $EXEC $CONF
      fi



      redis_stop()


      if [ ! -f $PIDFILE ]
      then
      echo "$PIDFILE does not exist, process is not running"
      else
      PID=$(cat $PIDFILE)
      echo "Stopping ..."
      $CLIEXEC shutdown
      while [ -x /proc/$PID ]
      do
      echo "Waiting for Redis to shutdown ..."
      sleep 1
      done
      echo "Redis stopped"
      fi





      case "$1" in
      start)
      redis_start
      ;;
      stop)
      redis_stop
      ;;
      restart)
      redis_stop
      redis_start
      ;;
      status)
      status -p $PIDFILE redis
      script_result=$?
      ;;
      *)
      echo "Please use start, stop, restart or status as first argument"
      ;;
      esac
      exit 0


      I have to make this service managed by redis user. It is relatively easy to do in redis.service file:



      [Unit]
      Description=Redis In-Memory Data Store
      After=network.target

      [Service]
      User= redis_user
      Group= redis_group
      ExecStart=/usr/local/bin/redis-server redis_conf_dir /redis.conf
      ExecStop=/usr/local/bin/redis-cli shutdown
      Restart=always

      [Install]
      WantedBy=multi-user.target


      But I don't know what arguments to pass and where to pass them in init file to make service manageable by redis user.







      linux ubuntu users init-script redis






      share|improve this question









      New contributor




      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      Rui F Ribeiro

      41.8k1483142




      41.8k1483142






      New contributor




      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      atabak-5atabak-5

      1




      1




      New contributor




      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      atabak-5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          atabak-5 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508735%2fmake-redis-service-init-file-manageable-by-user%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          atabak-5 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          atabak-5 is a new contributor. Be nice, and check out our Code of Conduct.












          atabak-5 is a new contributor. Be nice, and check out our Code of Conduct.











          atabak-5 is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508735%2fmake-redis-service-init-file-manageable-by-user%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          -init-script, linux, redis, ubuntu, users

          Popular posts from this blog

          Creating 100m^2 grid automatically using QGIS?Creating grid constrained within polygon in QGIS?Createing polygon layer from point data using QGIS?Creating vector grid using QGIS?Creating grid polygons from coordinates using R or PythonCreating grid from spatio temporal point data?Creating fields in attributes table using other layers using QGISCreate .shp vector grid in QGISQGIS Creating 4km point grid within polygonsCreate a vector grid over a raster layerVector Grid Creates just one grid

          What is this called? Old film camera viewer?What makes a good film camera?What to do with an old film camera?What should one look for when buying a used film camera?What is the value and age of this pre-1967 Ricoh 35 mm camera?DSLR recommendation, question about old Canon 35mm film Camera & lensesCan anyone identify the silver rangefinder-style camera in this advertisement?What kind of a Polaroid 600-camera is this?Will an old film camera still work even when not used in a very long time?What is this camera / Can I develop the film?How to fit an action camera into antique (bellows) housing?What to check when buying used and old film bodies?

          Why is this plane circling around the Lucknow airport every day?Why do aircraft on Flight Radar 24 jump around randomly sometimes?What airport has this walkway over a taxiway?How does Chicago O'Hare's tower sequence aircraft at peak capacity?Which airport is featured in this Delta commercial?After a crash, for how long is the airport closed?Can a passenger plane stand still in the air, or hover at a fixed location above a ground?What are those trucks towing around, and why?What is this airport outside of Cairo, Egypt?Which US airport has the lowest circling MDH?What is this airport video?