Solved

version of service

Posted on 2011-09-29
13
344 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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 Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now