Solved

version of service

Posted on 2011-09-29
13
356 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Fine Tune your automatic Updates for Ubuntu / Debian
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.

920 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

11 Experts available now in Live!

Get 1:1 Help Now