Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to check if an application has been installed on a unix/linux box? Post 302534005 by verdepollo on Sunday 26th of June 2011 11:56:40 AM
Old 06-26-2011
There is no "universal" command that is guaranteed to work on *ALL* UNIX/Linux flavors.

RHEL-based have rpm, Solaris has pkginfo, Debian-based have dpkg, I don't know about Arch but you get the point.

A simpler generic approach would be to find / -type f -name "sshd" but it's not bulletproof.

Another option would be to match your commands against /etc/*release but -again- it's not bulletproof either; I've seen several sysadmins modify this file in order to trick the system so that they can install unsupported applications (Oracle for example). Something like this:

Code:
if [ -n "$(egrep -i "(red hat|rh|rhel)" /etc/*release 2>/dev/null)" ];then
	# "service" or "rpm -q" or look for sshd in /etc/init.d
elif [ -n "$(egrep -i "(debian)" /etc/*release 2>/dev/null)" ];then
	# look for sshd in /etc/init.d
elif [ -n "$(egrep -i "(solaris|sunos)" /etc/*release 2>/dev/null)" ];then
	# svcadm or look for sshd in /etc/init.d
elif [ -n "$(egrep -i "(arch)" /etc/*release 2>/dev/null)" ];then
	# look for file in /etc/rc.d/
elif	
	# ...etc...
fi

The above code for instance won't work on a Linux minimal installation as it relies on "egrep" command.

It would be easier if you were looking for running processes; ps almost works the same in all Unix/Linux (either ps -A or ps -e should do).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run an application installed in another unix pc?

Do you guys have any suggestions? hpterm -e rlogin <another unix pc> ??? (1 Reply)
Discussion started by: jehrome_rando
1 Replies

2. UNIX for Dummies Questions & Answers

unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh` if $rshstatus <>0 then errstatus=1 mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr else if errstatus=0 echo "status to xirsol8dr successful" can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies

3. Solaris

Check if an application is accessible when trying to use http://localhost in Unix

Hm am the perfect newbie:o I handle an application on a production servers having a SunOS 5.8 and iplanet webserver instance. Users trying to access it on https are getting "Cannot find the server". I checked with the n/w and secuirty and they said traffic is allowed to the server. Everything... (6 Replies)
Discussion started by: JimmyJ
6 Replies

4. AIX

Can I make application for AIX while working on Linux Box

Hi all, I had a large application created using Visual C++. I ported that application using WINE to the Linux platform (ofcourse x86). Now I have to port the same application to AIX which runs over IBM mainframe. I dont have mainframe available but it is required for me to port my application to... (1 Reply)
Discussion started by: noble_curious
1 Replies

5. Solaris

Listing application installed on a Solaris box

I am trying to list all the applications that is installed on my sun solaris box. I have used the command pkginfo but it only give me the applications that was bundled with solaris. This machine runs oracle and pkginfo command does not list that. Any idea to get to list all the applications... (1 Reply)
Discussion started by: ibroxy
1 Replies

6. Red Hat

How to check if the Linux Box is available

Hi, I need to query and find out if anyone is logged into a Linux box or if the Linux Box is free available for login. This information is required to post the availability of the Linux Host for an instrument for another user to start using the instrument. Is there a command or script to query... (3 Replies)
Discussion started by: dks
3 Replies

7. UNIX for Dummies Questions & Answers

Copying application directory from one unix box to another

Hi , if I copy an application directory (with all its subdirectories) from one unix box to another (suppose same version), will that application work in the 2nd unix box? (3 Replies)
Discussion started by: me_saby
3 Replies

8. UNIX for Dummies Questions & Answers

Need to find the OS JRE as well as User installed JRE on my UNIX box!

Hi, I want to determine whether my java application is pointing to the OS version of Java or the User installed Java version on my Unix box. I am aware of the "java -version" command, however I am unsure if the version returned is the OS one or the user one. Please help. Ali. (5 Replies)
Discussion started by: ali40
5 Replies

9. Shell Programming and Scripting

Script to check if SQLLDR has been installed on Unix/Aix servers

How can i check if sqlldr has been installed on my AIX/UNIX mechine? Is there any unix script to check this one out.... (0 Replies)
Discussion started by: msrahman
0 Replies

10. UNIX for Beginners Questions & Answers

Bash find version of an installed application but if none is found set variable to App Not Installed

Hello Forum, I'm issuing a one line bash command to look for the version of an installed application and saving the result to a variable like so: APP=application --version But if the application is not installed I want to return to my variable that the Application is not installed. So I'm... (2 Replies)
Discussion started by: greavette
2 Replies
BUNDLE-PACKAGE(1)														 BUNDLE-PACKAGE(1)

NAME
bundle-package - Package your needed .gem files into your application SYNOPSIS
bundle package DESCRIPTION
Copy all of the .gem files needed to run the application into the vendor/cache directory. In the future, when running bundle install(1) bundle-install.1.html, use the gems in the cache in preference to the ones on rubygems.org. GIT AND PATH GEMS
Since Bundler 1.2, the bundle package command can also package :git and :path dependencies besides .gem files. This needs to be explicitly enabled via the --all option. Once used, the --all option will be remembered. REMOTE FETCHING
By default, if you simply run bundle install(1) bundle-install.1.html after running bundle package(1) bundle-package.1.html, bundler will still connect to rubygems.org to check whether a platform-specific gem exists for any of the gems in vendor/cache. For instance, consider this Gemfile(5): source "https://rubygems.org" gem "nokogiri" If you run bundle package under C Ruby, bundler will retrieve the version of nokogiri for the "ruby" platform. If you deploy to JRuby and run bundle install, bundler is forced to check to see whether a "java" platformed nokogiri exists. Even though the nokogiri gem for the Ruby platform is technically acceptable on JRuby, it actually has a C extension that does not run on JRuby. As a result, bundler will, by default, still connect to rubygems.org to check whether it has a version of one of your gems more spe- cific to your platform. This problem is also not just limited to the "java" platform. A similar (common) problem can happen when developing on Windows and deploy- ing to Linux, or even when developing on OSX and deploying to Linux. If you know for sure that the gems packaged in vendor/cache are appropriate for the platform you are on, you can run bundle install --local to skip checking for more appropriate gems, and just use the ones in vendor/cache. One way to be sure that you have the right platformed versions of all your gems is to run bundle package on an identical machine and check in the gems. For instance, you can run bundle package on an identical staging box during your staging process, and check in the ven- dor/cache before deploying to production. March 2013 BUNDLE-PACKAGE(1)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy