LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2004, 02:19 AM   #1
yoshi95
LQ Newbie
 
Registered: Mar 2004
Posts: 2

Rep: Reputation: 0
shell script newbie question


i have a file in /proc directory that stores some tcp parameters.............i heard that files in /proc directory has a 1 page size limit

how do i want to write a shell script that reads the proc file from time to time and save it as a text file, and then read some more and append whatevers new to the text file?

the file format of /proc/tcp_parameters is:
2 3 4
3 5 5
6 5 3
...

i want to read the proc file, then store it as a text file
then sometime later, like 1 or 2 sec later, read the file again and apend whatevers new to the txt file?

i tried doing

cat tcp_parameters > /home/tcpvars

but i have no idea how do deal with the time issue, and the '>' overwrites everything instead of appending

thanks in advance
 
Old 03-11-2004, 02:43 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
try:

"while sleep 10;
do
cat tcp_parameters >> outfile
done"

sleep 10 # sleep for 10 seconds
>> # append to file

press control-C to stop the process

if you just need to observer the file you could also try:

"tail -f tcp_vars"

which prints the file continuously as it changes. But maybe this
won't work on a /proc file?


regards , billy
 
  


Reply



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
newbie help on small shell script ripcurl Programming 5 09-20-2005 03:17 PM
shell script question Whiteghost Programming 17 09-10-2005 06:52 PM
Shell Script Question. rvijay Linux - General 2 07-14-2005 06:41 PM
Shell script newbie needs help! allididntwantto Programming 2 04-21-2005 05:53 AM
veprory simple but frustrating for a newbie shell script question marigb Linux - Newbie 11 04-28-2004 12:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:32 PM.

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
Open Source Consulting | Domain Registration