Solved

version of service

Posted on 2011-09-29
13
366 Views
Last Modified: 2012-06-21
hello there,
there is a service installed on centos v5.6 64bit
I would like to see the version and if its 64bit.. how can I do that?
0
Comment
Question by:XK8ER
  • 6
  • 6
13 Comments
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36818548
rpm -q --qf  "%{n}-%{v}-%{r}.%{arch}\n"  <package name>
<package name>.x86_64

or
echo  '%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}'  >> ~/.rpmmacros
then do
rpm -q <package_name>
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818552
For example:
$ rpm -q --qf "%{n}-%{v}-%{r}.%{arch}\n" vim-common
vim-common-7.0.109-3.el5.3.x86_64
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818654
Wesly,

Curious, why all extra formatting stuff?  I have never seen it done that way, just wondering what the reason is behind it.

If you know for example the name of the init script, you can just do
rpm -qf filename

Open in new window

[root@broken ~]# rpm -qf /etc/init.d/httpd
httpd-2.2.15-5.el6.centos.x86_64

Open in new window

0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818679
You have the setting in ~/.rpmmacros to show %%{arch} as I mentioned in the first post.
Otherwise, you won't see .x86_64
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818688
[root@broken ~]# cat ~/.rpmmacros
cat: /root/.rpmmacros: No such file or directory
[root@broken ~]# locate .rpmmacros
[root@broken /]# find . -name .rpmmacros -type f
[root@broken /]#

0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818702
[root@broken rpm]# pwd
/usr/lib/rpm
[root@broken rpm]# head macros
#/*! \page config_macros Default configuration: /usr/lib/rpm/macros
# \verbatim
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
# should be added to /etc/rpm/macros, while per-user configuration should
# be added to ~/.rpmmacros.

Open in new window

0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818703
which Linux distribution do you have?
I tested on my CentOS 5.x.
Without setting in rpmmacros, it won't show %%{arch} by default.
--------
# cat ~/.rpmmacros
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

# mv /root/.rpmmacros   /root/.rpmmacros_old

#  rpm -qf /etc/init.d/httpd
httpd-2.2.3-53.el5.centos.1

# mv /root/.rpmmacros_old   /root/.rpmmacros

#  rpm -qf /etc/init.d/httpd
httpd-2.2.3-53.el5.centos.1.i386
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818707
CentOS 6

I don't recall having to do that on 5.x either... let me check some RHEL5's at work
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818718
On CentOS 5.x
# grep query_all_fmt  /usr/lib/rpm/macros
%_query_all_fmt         %%{name}-%%{version}-%%{release}
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818771
[user@phx1mmail1 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[user@phx1mmail1 ~]$ grep query_all_fmt /usr/lib/rpm/macros 
%_query_all_fmt  %%{name}-%%{version}-%%{release}

Open in new window

[root@broken rpm]# grep query_all_fmt macros
%_query_all_fmt         %%{nvra}
[root@broken rpm]# grep nvra !$
grep nvra macros
%_query_all_fmt         %%{nvra}
[root@broken rpm]# cat /etc/redhat-release
CentOS Linux release 6.0 (Final)

Open in new window


Not sure what nvra is, and I'm not doing the research right this sec... stupid busy day at work... I hate computers ;)




Always learn new stuff on EE ;)
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818783
> what nvra is
Name Version Release Arch
new stuff in RHEL6.x
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818802
> what nvra is
Name Version Release Arch
new stuff in RHEL6.x

Hah.. duh... in hindsight that seems so obvious.  I'm definitely burnt out for the day...
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36818824
wonderful.. thanks so much!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question