The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to write script in tar naveeng.81 Shell Programming and Scripting 1 04-18-2008 01:04 PM
Please write this script for me nadman123 Shell Programming and Scripting 1 04-08-2008 11:30 PM
Help me to write the script gyana_cboy Shell Programming and Scripting 5 10-05-2007 03:19 AM
How to write script for this ? me_haroon AIX 0 07-01-2006 07:30 AM
need help to write shell script getdpg Shell Programming and Scripting 0 04-10-2006 11:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-02-2004
fundidor fundidor is offline
Registered User
  
 

Join Date: Oct 2003
Location: Rio de Janeiro - Brazil
Posts: 37
Help! Need to write my first script

Hi Folks!


I am a MacUser and am trying to learn Unix for the last few months.

I will explain in detail what I am trying to do, and apreciate you help if you can teach me even if it is a single comand line inside the script.

I own a small company, where I manufacture special gypsums and plasters for dental use. Outside my office, I have a equipment, a scale, that can weigh pallets from 0 to 3000Kg. This scale is connected to my small network and has its own web server.

If I type on this URL: http://169.254.79.250/peso.html on any web browser, on any computer, on my small network, a request is sent to the webserver installed on my scale and a page as this is displayed:

example in .html: Click here for example.

(this example contains a Javascript that will direct you to an error page after a few seconds. You might need to click on the "back" button of your browser)

example of the source code in pdf: click here for example in pdf

One can notice inside the code where it is written "0,0Kg". This is the variable. As one of my employees places a new pallet with a diferent new weight this value changes.

OK!

This is what I want to do:


I want to write a script to run on the Macs's Unix terminal and do this:

1) Capture the html source code on http://169.254.79.250/peso.html (this is a reference in my small network)

2) Identify the variable inside the code, let's say each 10 seconds. (the value just before Kg)

3) Use a logical function to determine if the value has changed, and if it did change , write a line in a text file. (pesolog.txt)

Example of pesolog.txt:

O January 2nd 2004 at 12:45 peso has changed to 1254Kg
On January 2nd 2004 at 13:15 peso has changed to 1869kg
etc...

I thank you for your help, even if it is just a single command line.

Greeting from
Bernardo Höhl
Rio de Janeiro - Brazil

PS: This site is so CPU intensive on my Mac. My computer runs very, very slow when I have this page running.. Do you experience the same problem?
  #2 (permalink)  
Old 01-02-2004
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
Re: Help! Need to write my first script

Quote:
Originally posted by fundidor

PS: This site is so CPU intensive on my Mac. My computer runs very, very slow when I have this page running.. Do you experience the same problem?
Go to user panel (User CP) and change the theme to another one. Seems like "InfoPop" is the most lightweight one.
  #3 (permalink)  
Old 01-04-2004
Lazzar Lazzar is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 32
hi,
wouldnt it be easier to write the LogFile from the website?

with html, php, javascript or whatever works?

Lazzar
  #4 (permalink)  
Old 01-04-2004
fundidor fundidor is offline
Registered User
  
 

Join Date: Oct 2003
Location: Rio de Janeiro - Brazil
Posts: 37
Dear Lazzar,


We have to keep in mind that we need to capture code from a WebServer that has no hardisk or I have access to changing the way it works.

Let's assume that whatever I build, I will build on my computer.

Question 1) Can Javascript capture code on the remote WebServer and write it on my harddisk?

Question 2) Can PHP do just the same?

Could you give an example of how it can be done?

Thanks for your comments!

Bernardo Höhl
  #5 (permalink)  
Old 01-05-2004
Lazzar Lazzar is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 32
aww sorry i can't, it was just a wild guess


Lazzar
  #6 (permalink)  
Old 01-08-2004
fundidor fundidor is offline
Registered User
  
 

Join Date: Oct 2003
Location: Rio de Janeiro - Brazil
Posts: 37
Hi folks!

I have been able to display the souce code by typing the following:

telnet 169.254.79.250 80
GET /MostraPeso.shtm HTTP/1.0
User-Agent: Mozilla/1.1N (Macintosh; I; 68K)
Accept: */*

It works. I get the source code displayed on my terminal.

But when I write the shell script with these comands, only the first comand is executed. The next lines are only executed once the conection has been closed.

I think some lines are missing on the shell script to make it executable within the conection.

Please help!

Thanks!
Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0