Help! Need to write my first script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help! Need to write my first script
# 1  
Old 01-02-2004
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  
Old 01-02-2004
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  
Old 01-04-2004
hi,
wouldnt it be easier to write the LogFile from the website?

with html, php, javascript or whatever works?

Lazzar
# 4  
Old 01-04-2004
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  
Old 01-05-2004
aww sorry i can't, it was just a wild guess Smilie


Lazzar
# 6  
Old 01-08-2004
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!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help me to write the script

Hi All, I have written the follwing script to take the backup of the file every day along with the date. DATE=`date +%Y%m%d` export DATE cp var/hr/hr333m.txt cp var/hr/payments/hr333m_$DATE.txt The file name as follows after taking the backup. hr333m_20110630.txt Could you... (3 Replies)
Discussion started by: ajaykumarkona
3 Replies

2. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

3. Shell Programming and Scripting

Q: How to write this script?

Hi there :rolleyes: I have a folder called backup it is path is: ~/backup Inside this folder, there are four files: ~/backup/test1.cpp ~/backup/test2.cpp ~/backup/test3.cpp ~/backup/PATHS.TXT The fourth file PATHS.TXT contains the original paths for the three files. This is the... (4 Replies)
Discussion started by: domain
4 Replies

4. AIX

how to write this script?

If I need delete some disk, for i in hdisk1 hdisk2 hdisk3 hdisk4 do rmdev -dl $i done if I have more than 100 hdisks, how to write a script like that to delete them? (6 Replies)
Discussion started by: rainbow_bean
6 Replies

5. Shell Programming and Scripting

Script Help - Another Way To Write This

I am adapting an Open Step ping server script to Ubuntu 8.10 and one section of my script isn't working # if there are servers that just went down or came back up, notify # with high importance if ; then echo notifying of servers that are up again or just now down notify high # if there... (2 Replies)
Discussion started by: gbxfan
2 Replies

6. Shell Programming and Scripting

Better way to write this script

Hi All, I have written the following script. I have just repeated some commands, and I am sure there is a more better way to do it. I hope I one of gurus here will help me make it in a better shape. Here is the script: #! /bin/sh sed -i -e "s/test2.xxx/test3.xxx/" -e "s/output2/output3/"... (2 Replies)
Discussion started by: faizlo
2 Replies

7. UNIX for Dummies Questions & Answers

Should I write a PERL Script or Shell Script?

Hello, I have done some BASIC shell scripting/PERL scripting before so I am familiar with the languages. I am not really sure which one would lend itself better to the application I have to write. I am required to scan the message logs for possible break in attempts. If I use shell scripting... (2 Replies)
Discussion started by: mojoman
2 Replies

8. Shell Programming and Scripting

Please write this script for me

UNIX shell script (Bourne shell syntax) called admin_script. This script is described below as a usage summary: admin_script Note: if no options are specified, a menu is displayed which allows users to perform one of the following tasks and then exit. If incorrect options are provided,... (1 Reply)
Discussion started by: nadman123
1 Replies

9. Shell Programming and Scripting

Help me to write the script

Actually i am working with two diffrent files having same structure each file contain Ten diffrent column and i want to write a script which will compare the colummns of first file with the column of second file and diiference will be send to the first column of third file . similarly for... (5 Replies)
Discussion started by: gyana_cboy
5 Replies

10. AIX

How to write script for this ?

Hi All, I want to read username and lastupdate only from /etc/security/passwd and write the same data to another file: The data in /etc/security/passwd will be in this form for example: For more details : http://www.unet.univie.ac.at/aix/files/aixfiles/passwd_security.htm#A1219924 smith:... (0 Replies)
Discussion started by: me_haroon
0 Replies
Login or Register to Ask a Question