Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Script to test temperature problems
PostPosted: Mon Oct 19, 2009 8:37 pm 
Offline

Joined: Sat Mar 21, 2009 5:48 am
Posts: 10
Hello,

I have problems writing to the onboard SD card reader, such as described: http://forum.eeeuser.com/viewtopic.php?id=19216

I would like to try something, but I am new to Linux. Is there a script similar to what you can do with DOS batch files that I could run to do the following:

Copy a quantity of files from a temp directory to the SD card; log this to a results file
Copy the temperature to the results file via acpi -V
Delete the copied files from the SD card
Repeat the above process 100 times

This would provide a log of if this an intermittent problem that only occurs at higher temperatures.

Can anyone here help me with this script?


Top
 Profile E-mail  
 
 Post subject: Re: Script to test temperature problems
PostPosted: Mon Oct 19, 2009 9:43 pm 
Offline
Moderator

Joined: Fri May 29, 2009 7:09 pm
Posts: 319
eeePC model: 901
Aurora version: Base 3.0
Something like
Code:
cp -R /directory/temp /media/sdcard/ >> /home/evbrown/results.log
acpi -V >> /home/evbrown/results.log
rm -rf /media/sdcard/temp
/home/evbrown/script.sh
where the temp directory is /directory/temp, the sd card is mounted at /media/sdcard, and your results and script are in /home/evbrown (all probably need to be changed), and your scripts is named script.sh.

The >> tells bash/csh/whatever to write to end of file, so you can use that to log pretty much anything.

The last line just calls the script again. May want to do something different so it doesn't run forever.


Top
 Profile E-mail  
 
 Post subject: Script to test temperature problems
PostPosted: Tue Oct 20, 2009 2:07 pm 
Offline

Joined: Sat Mar 21, 2009 5:48 am
Posts: 10
Kool!

So if I wanted this to run for 100 iterations, would the code look like?

for(i=0;i<100;i++)
do
/home/evbrown/script.sh
done

The script.sh would be as you coded above, except I would need to remove the last line:
/home/evbrown/script.sh

Do I have the syntax correct?


Top
 Profile E-mail  
 
 Post subject: Re: Script to test temperature problems
PostPosted: Tue Oct 20, 2009 3:14 pm 
Offline
Moderator

Joined: Fri May 29, 2009 7:09 pm
Posts: 319
eeePC model: 901
Aurora version: Base 3.0
Looks like the for syntax (I don't use it much) is like this for counts
Code:
for (( i=1; i<=100; i++ ))
If I remember right, the double parenthesis means evaluate.

Other than that, just 2 things to remember. Put #!/bin/bash at the beginning of both files, and chmod +x to make them executable.


Top
 Profile E-mail  
 
 Post subject: Script to test temperature problems
PostPosted: Tue Oct 20, 2009 3:36 pm 
Offline

Joined: Sat Mar 21, 2009 5:48 am
Posts: 10
Great. Thank you!


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: