0

For example, on my Red Hat Enterprise Linux 7.2 there are

/etc/rc.d/init.d/rabbitmq-server
/etc/logrotate.d/rabbitmq-server
/usr/sbin/rabbitmq-server
/usr/lib/ocf/resource.d/rabbitmq/rabbitmq-server

more than 4 'kinds' of rabbitmq-server (in fact there are 2 other ones ), are they the same thing? I mean, if I want to start rabbitmq can I use either of those command rabbitmq-server?

1
  • I'm so sorry for the unclear title! Everyone knows same name files in different directory may contain different things. I wanted to ask whether that also apply to programs, I hope I made that clear in my question. I apology for that, however, I'm not changing the tile for there are already two answers for the title (for my real questions as well, thanks!)
    – shintaroid
    Commented Aug 21, 2016 at 5:50

2 Answers 2

4

No, they are totally different and have different content.

For example I have

A/file
B/file

$ cat A/file
hello

$ cat B/file
there

We can see they say different things.

In your case:

/etc/rc.d/init.d/rabbitmq-server - this will be the startup at boot time script

/etc/logrotate.d/rabbitmq-server - this will manage the log files

/usr/sbin/rabbitmq-server - this is the main server program that's started by the init script

/usr/lib/ocf/resource.d/rabbitmq/rabbitmq-server - this is part of your HA configuration.

So all 4 files do different things.

1
  • 1
    Note that they may not all be different, some may be symlinks to others. I wouldn't be surprised if etc/rc.d/init.d/rabbitmq-server linked to /usr/sbin/rabbitmq-server. You could always use readlink to find out.
    – Centimane
    Commented Aug 20, 2016 at 0:00
1

Much like in many environments, it's certainly possible to have multiple files with the same name in several locations.

There are several ways to see if the files are identical (or indeed are the same file with multiple links).

First, you can use a tool such as diff to compare the contents of files. If they are different, you will be shown the differences (or informed that they are different if the files are interpreted to be binary files):

diff /etc/rc.d/init.d/rabbitmq-server /etc/logrotate.d/rabbitmq-server

Secondly, you can use the long form of ls to see if a file is a symbolic (or "soft" link. This will show both that a given file is a symbolic link, and the location to which it points:

$ ls -l bar
lrwxrwxrwx 1 ghoti ghoti 3 Aug 18 18:34 bar -> foo

The l in the first column shows that bar is a link, and the end of the line, bar -> foo, shows that foo is the location to which bar points.

ls -l will also show you how many hard links a file has:

$ ls -l foo
-rw-rw-r-- 2 ghoti ghoti 0 Aug 18 18:36 foo

In this case, the 2 between the permissions and the owner shows that foo is a file to which there are two hard links. You can use find to locate files that are hardlinks to the same file:

find / -samefile foo

The above command will search the entire filesystem for all hardlinks to foo

As to your question about the correct way to start rabbitmq, this is best found by consulting the manual page:

man rabbitmq
1
  • Thanks for your nice answer. I'm sorry for the unclear title, I was not intended to ask the question you answered, my bad. Thanks for your precious time, I really appreciate it.
    – shintaroid
    Commented Aug 21, 2016 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .