LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-12-2010, 02:41 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
Integrating bash with sql.


Hi Guys,
I m just curious to know whether it is possible to store the output of a shell command to a database .

My main aim is to use a full capacity of sql language to analyze the output generated by shell script.
for example.

by storing the 5 instances of of top at different interval we can simply predict lot of things like.
Which process has Maximum cpu utilization, Which user has maximum processes running.
I think writing a scripts for doing these tasks will require lot of overheads and file creation.

I hope i have clear my point .Please reply if any further clarification is required.

Last edited by pinga123; 08-12-2010 at 02:43 AM.
 
Old 08-12-2010, 03:17 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Sure it's possible, you might want to look at something lightweight like sqlite which basically pretends to be a full sql database but is actually just a small file, which makes using it really simple. You can just pipe SQL commands into the sqlite program directly. e.g. "echo select * from mytable | sqlite mydb.sql". This is also pretty trivial with other proper DB's like mysql or postgresql.

Alternatively why not use a proper program to do this? It's not GPL software, but Splunk is an amazingly good tool for doing exactly what you want, running arbitrary commands and reading any log data and then hacking about the output to provide all osrts of graphs and data baout the logs.
 
Old 08-12-2010, 04:46 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by acid_kewpie View Post
Sure it's possible, you might want to look at something lightweight like sqlite which basically pretends to be a full sql database but is actually just a small file, which makes using it really simple. You can just pipe SQL commands into the sqlite program directly. e.g. "echo select * from mytable | sqlite mydb.sql". This is also pretty trivial with other proper DB's like mysql or postgresql.

Alternatively why not use a proper program to do this? It's not GPL software, but Splunk is an amazingly good tool for doing exactly what you want, running arbitrary commands and reading any log data and then hacking about the output to provide all osrts of graphs and data baout the logs.
We are using Oracle enterprise manager as an alternative to Splunk.However i will try the sqlite seems goods but i m yet to explore the it. I will share my views if found useful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] SQL Command output to bash variables chirayu11 Linux - Newbie 5 08-04-2010 07:40 AM
[SOLVED] Running SQL commands from within bash chirayu11 Linux - Newbie 6 08-02-2010 06:38 AM
Run SQL update statement in a for loop in bash testac Programming 8 06-11-2010 10:18 AM
[SOLVED] Bash script: Need some help on how to parse a simple SQL query newbie_0404 Linux - Newbie 10 06-02-2010 12:31 AM
Iterate over SQL results in bash script. Is there a better way to do this? word_virus Programming 4 11-09-2008 10:15 AM


All times are GMT -5. The time now is 08:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration