LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware external drive cronjob help (https://www.linuxquestions.org/questions/slackware-14/slackware-external-drive-cronjob-help-909711/)

Daedra 10-23-2011 06:17 PM

Slackware external drive cronjob help
 
Hi guys,

I bought a cheap external enclosure for my 2tb hard drive and it is working fine, but the thing keeps going to sleep every 5 or so minutes of inactivity. The enclosure doesn't support advanced power features so I want to make a cronjob to write a zero byte or "ls" the top directory every few minutes to keep it awake, I tried a cronjob that touches the drive every few minutes but its not keeping it awake, so I need a new idea

Thanks in advance.

mRgOBLIN 10-23-2011 07:07 PM

fdisk usually wakes things up

backblaze.pl 10-24-2011 03:52 AM

Does `hdparm -S 0 -B 251 /dev/sdX' work with this drive? If '-S 0' doesn't work, try high values (RTFM for details), like '-S 251'.

What is wrong with energy-saving anyway? If you access the drive less then 12 times per hour, why shouldn't it sleep? Maybe you should try even shortening the inactivity timeout down to fifteen seconds?

--
Cheers,
backblaze.pl

Daedra 10-24-2011 07:05 PM

Quote:

Originally Posted by backblaze.pl (Post 4506350)
Does `hdparm -S 0 -B 251 /dev/sdX' work with this drive? If '-S 0' doesn't work, try high values (RTFM for details), like '-S 251'.

What is wrong with energy-saving anyway? If you access the drive less then 12 times per hour, why shouldn't it sleep? Maybe you should try even shortening the inactivity timeout down to fifteen seconds?

--
Cheers,
backblaze.pl

Nothing is wrong with energy saving but all my files are on the drive so I access it constantly. I have tried the above command before and like I said the enclosure does not support advanced power features. I get errors like this

hdparm -S 0 -B 251 /dev/sdc

/dev/sdc:
setting Advanced Power Management level to 0xfb (251)
HDIO_DRIVE_CMD failed: Input/output error
setting standby to 0 (off)
HDIO_DRIVE_CMD(setidle) failed: Invalid argument
APM_level = not supported

my only option is a cronjob.

catkin 10-25-2011 06:16 AM

A cron job doing an ls on the drive sounds feasible. Have you tried it? Did you get stuck? If so, where did you get stuck?

dive 10-25-2011 06:35 AM

MrGoblin has already suggested fdisk. Have you tried 'fdisk -l >/dev/null 2>&1' ?

Woodsman 10-25-2011 11:42 AM

How does the enclosure control the hard drive as described? A link describing the enclosure hardware might help explain what is happening. Possibly a link describing the hard drive too.

Daedra 10-25-2011 07:09 PM

Sorry for the late reply, I should of been more specific about my cronjob. I have never had to use a cronjob until now, so I guess my question what is the best method to make a cronjob, Right now I just added */1 * * * * ls /mnt/backup &>/dev/null to my /etc/rc.d/rc.local. Is this method ok or is there a better way?

Thanks.

dive 10-25-2011 07:29 PM

Quote:

Originally Posted by Daedra (Post 4508285)
Sorry for the late reply, I should of been more specific about my cronjob. I have never had to use a cronjob until now, so I guess my question what is the best method to make a cronjob, Right now I just added */1 * * * * ls /mnt/backup &>/dev/null to my /etc/rc.d/rc.local. Is this method ok or is there a better way?

Thanks.

I'm not sure I understand. You added the cron command to rc.local? This is definitely not OK. You need to run 'crontab -e' and add it there.

Daedra 10-25-2011 07:47 PM

Yes I did add it rc.local. Thats how I think I screwed up, I am reading man pages on crontab right now. I should know how to do this but ironically I have never had a to use cron until now.

dive 10-25-2011 07:57 PM

Yeah, run 'crontab -e' and it'll open in vi and you can put your commands there.

One of the gotchas with crontab to be aware of is that is doesn't have the full system environmental variables like $PATH, so it's always good practice to put the full path of any program you need to run.

/bin/ls

(actually that one may work without the path but you get the idea).


All times are GMT -5. The time now is 02:35 AM.