UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 15th, 2009, 10:15 PM
gbrent gbrent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 94 gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 4 m 53 sec
Reputation Power: 13
Simple shell script variable question

I want to run a cron job that calls an sh script which will run wget to a webpage. This webpage will respond with $_SERVER['REMOTE_ADD'] which is the php variable that will show what IP is accessing the website.

I then want to take this IP address and make it a variable for the rest of my sh script... example...

#!/bin/sh
currentIP=[response from wget http://site.com/yourip.php]
echo This is the ip address $currentIP
exit 0

what can I put in place of [response from wget http://site.com/yourip.php]?

I have tried simply currentIP=wget http://site.com/yourip.php but that does not work.

I DO NOT want to grab the IP from ifconfig for reasons that my project will not allow and secondly... because I want to know how to do it this way. I don't want to pass it as a variable to the script either... I really want to learn how to do it with sh. Forgive me if I am stubborn, but hey, I have to learn somehow.

Thanks
gbrent

Reply With Quote
  #2  
Old September 15th, 2009, 11:02 PM
gbrent gbrent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 94 gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level)gbrent User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 4 m 53 sec
Reputation Power: 13
#!/bin/sh

current_ip=$(wget -q -O - ISYP_CRON_V1 http://site.com/yourip.php)
echo This is the ip address $current_ip


Works for me.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Simple shell script variable question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek