0

What are the differences between the two following ways or starting something, first being:

/etc/init.d/redis-server start

And second:

/usr/bin/redis-server

I've never really fully understood why which is preferred over the other.

  • Might be related: http://askubuntu.com/questions/5039/what-is-the-difference-between-etc-init-and-etc-init-d – Terrance Nov 23 '15 at 23:40
  • How do you stop the service? – muru Nov 23 '15 at 23:55
  • @muru Normally I have to get the process id via ps aux | grep redis-server and the do a kill kill -9 <PID>. Which is annoying. – Karl Morrison Nov 24 '15 at 16:56
  • @KarlMorrison there you have it. The init script is supposed to take care of that for you. It has a stop command, and other related commands like status, restart, etc., a standardised set so that you don't have to figure out how to do those things. – muru Nov 24 '15 at 17:18
  • @muru I guess I'm learning new things everyday :) What about service redis-server start/stop? Those I do know that I need to get the pid and kill. – Karl Morrison Nov 24 '15 at 17:22
  • 1
    @KarlMorrison you shouldn't have to. There are different init systems (i.e., systems to manage services and boot), and naturally they all have different command sets. The service command is a wrapper script which calls the correct set of commands depending on the system. In this case, the same init.d script you mentioned - you shouldn't have to kill manually. If you do, it's a bug and should be reported. – muru Nov 24 '15 at 17:24
  • @muru I guess I am doing something incorrect on my server setup, I will look into it. Thanks for the insight! – Karl Morrison Nov 24 '15 at 17:25
  • 1
    Also see: http://askubuntu.com/q/2075/158442 – muru Nov 24 '15 at 17:26
  • 1
    Also, do lookup the pkill command. – muru Nov 24 '15 at 17:28

1 Answers1

0

Whatever goes into /etc/init.d is a script that starts a service and may define appropriate level where the script runs - single user mod, multiuser, shutdown; it's not the service itself.

Whatever goes into /usr/bin is the actual server, it is the executable file.

The analogy from windows world would be .exe files vs scheduled services that call those .exe files

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497