PDA

View Full Version : Help writing shell script.



Tim M
23rd September 2007, 04:20 PM
Hi all. I need the help of an experienced shell scripter. I need a program that will access my hard drive at least once a minute. And I need to to run continuously from boot up till shut down.

Henning1966
23rd September 2007, 04:27 PM
why?
Can't you use a cron script?
why?

PatMcLJr
23rd September 2007, 04:28 PM
maybe a cron job would do it?

like
touch me
rm me


?

Tim M
23rd September 2007, 05:02 PM
yes
If my drive isnt accessed it apparently goes to sleep. There is no setting in my bios for this so i need a program that will access it often.

stevea
23rd September 2007, 05:06 PM
Yo ucould use a cronjob, but nothing wrong with a script either.

Something like

#!/bin/bash
while true; do sleep 59; touch /tmp/me; sync; rm /tmp/me; done

Then add a line to /etc/rc.d.rc.local to start the script like

/usr/local/bin/funnyscript &
where the foinal ampersan is important.

Tim M
23rd September 2007, 05:08 PM
Could you please be a little more specific? I have never heard of a cron job

stevea
23rd September 2007, 05:10 PM
Before yo udo tho' try the command ...


hdparm -s 0 /dev/sda
(or whatever the drive device is).

Tim M
23rd September 2007, 05:16 PM
command not found