?
Solved

version of service

Posted on 2011-09-29
13
Medium Priority
?
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 38

Accepted Solution

by:
wesly_chen earned 2000 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
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 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