LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-23-2008, 04:26 AM   #1
Skiltron
LQ Newbie
 
Registered: Dec 2008
Location: Amsterdam, Holland
Distribution: Ubuntu and TinyMe
Posts: 4

Rep: Reputation: 0
start application using shell script


Hey

I'm kind of new to shell scripts..
I want to start an application when the dhcp3-server sends out a lease

I got the line:

ip=sudo tail /var/log/syslog | grep "dhcpd: DHCPACK" | cut -d " " -f 9
echo $ip

output:
192.168.0.29
192.168.0.30

Now I'd like my app to start so no echo anymore
In the terminal you would start it as "appname 192.168.0.29"

Is that possible and can the app start as a new thread?
So you could run it twice at the same time?

Thanks a lot,
 
Old 12-23-2008, 08:09 PM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,005

Rep: Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624
not quite sure what you are trying to do. also [code] tags make it easier to read.

^i think you are missing backticks
Code:
ip=`sudo tail /var/log/syslog | grep "dhcpd: DHCPACK" | cut -d " " -f 9`
now if you want to run a program then add this line to your shell script:
Code:
appname 192.168.0.29 &
the & sends it to the background the script will go to the next line without waiting for it to finish.


this seems more programming appropriate.
 
Old 12-24-2008, 12:51 PM   #3
Skiltron
LQ Newbie
 
Registered: Dec 2008
Location: Amsterdam, Holland
Distribution: Ubuntu and TinyMe
Posts: 4

Original Poster
Rep: Reputation: 0
Sorry for being so unclear

I'd like to make it continuous so I added the -f to tail.
every time there is a dhcpack in the syslog the application should start with the ip address as an parameter value.

In the terminal you could start the application this way:
Code:
appname ip
For instance:
Code:
app 192.168.0.29
Thanks for your help man:P
 
  


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
Converting a shell script with dialog boxes into a GNOME application kushalkoolwal Programming 4 10-17-2008 06:21 AM
executing shell script from java application maheshkodamati Programming 5 02-24-2008 11:39 AM
Opening file with default application from shell script? bourbon_beast Programming 4 04-13-2004 01:52 AM
How to bring up application window to front from shell script. aleksas_m Linux - General 2 08-21-2003 01:22 PM


All times are GMT -5. The time now is 01:25 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration