LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2011, 11:05 AM   #1
waha87
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Rep: Reputation: 0
Bash script to check ioCube and suphp is installed


Hi Friends

Kindly help me write a bash script to check ioncube loader is installed and also the suphp is enabled. I know "Php -v" will show the details of the ioncube loader and also i can get suphp information from "/usr/local/apache/conf/php.conf. But i don't know how to check it using a script. So if someone could some light on how to get do this.

Server: CentOS 5.6 with cpanel
 
Old 10-25-2011, 12:20 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Scripting is fairly simple if you already know the command line and output.

So tell us exactly what you type to check it manually and what you see when you type that and it should be simple for us to tell you what should be in your script.

For example if you type "php -v" and it outputs something like:
PHP 5.1.6 (cli) (built: Apr 7 2009 08:00:04)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

And you wanted to find whether it had Zend your script could be as simple as:

Code:
if php -v |grep Zend 
then echo Zend is installed
else echo Zend is NOT installed
fi
The above simply checks to see if Zend appears in the output of php -v. If it does then it prints a message saying it is installed. Otherwise it prints a message saying it is not installed.
 
Old 10-25-2011, 11:27 PM   #3
waha87
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Smile

Thank you MensaWater.

This is all i wanted. I didn't know that i can directly use " if" close like this. You really helped me. Now i know how to proceed.

Thanks again.
 
  


Reply

Tags
bash scripting



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help Running a Check in Bash Script Duo11 Linux - General 14 04-04-2011 08:15 AM
Does my server have suPhp installed if these are the settings writtensouls Linux - Server 2 09-02-2008 01:33 PM
bash script to check mount is ok procfs Programming 2 01-17-2007 06:19 PM
how to have bash script check whether it's a x session? bkeeper Linux - Newbie 9 02-21-2006 06:31 AM
Shell Script to Check apache installed or not. apt Programming 7 12-06-2004 11:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration