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

          Word for a person who has no opinion about whether god existsWord for having a definite opinion while simultaneously withholding judgment?What's the opposite of “newcomer? Is ”veteran" OK?What do you call an “atheist” who might believe in an afterlife?What's a word for someone who wants to voice opinions but not have them challenged?Word for someone who dismisses contrary opinions as irrational?Somone who thinks they are overly special/out of the ordinaryIs there a word, phrase or idiom for “a person who is incapable of thinking about the future”?The belief that a god is human-likeA word for a non-famous person/thing you have heard a lot aboutAdjective for a person who enjoys taking care of their appearance

          Can I redirect output to a log file and background a process at the same time?2019 Community Moderator ElectionUnable to write to file in shell script when running command in backgroundredirect and log script outputhow to properly log the output of a console program that frequently updates “parts” of the screen, resulting in a messy log file?How can I redirect the output of a child process?grep script - output lines at the same time into echoHow to run process in background and get its pid to create log file nameHow to redirect output to a log from expect commandHow to clear a redirect log file content in shell?Log background jobs started in all the manually started shells?Why do `jobs` and `dirs` run in command subsitution, process substitution, pipeline, and background jobs output the same as in original shell?How to redirect output to file to STDOUT?