Birdybird
Posts: 26
Joined: Tue Sep 10, 2019 12:01 pm

Creatief cron job

Tue Sep 10, 2019 12:16 pm

I want to spindown my usbdisk with command:
5 * * * * sudo sdparm
--command=stop /dev/sda1
Via cronjob -e
(Username pi)
It does not work. When i normally give the command it works.
I restarted cron but nothing happens in 5 minuten.
Please help

pcmanbob
Posts: 6968
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Creatief cron job

Tue Sep 10, 2019 1:05 pm

Hi.

Does the command work if you try it at the command line ?
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
scruss
Posts: 2494
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Creatief cron job

Tue Sep 10, 2019 1:44 pm

A crontab line starting with

Code: Select all

5 * * * *
runs five minutes after the hour (so 00:05, 01:05, 02:05, …). If you want it to be spun down every five minutes, use:

Code: Select all

*/5 * * * *
There may be a way of telling the drive (using sdparm/hdparm) to spin down after X minutes idle rather than forcing it off every five minutes regardless of whether it's busy.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Birdybird
Posts: 26
Joined: Tue Sep 10, 2019 12:01 pm

Re: Creatief cron job

Tue Sep 10, 2019 1:59 pm

i tried this command now but it still does not work.

*/5 * * * * sudo sdparm --command=stop /dev/sda1

please help

User avatar
RaTTuS
Posts: 10462
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Creatief cron job

Tue Sep 10, 2019 2:29 pm

Birdybird wrote:
Tue Sep 10, 2019 1:59 pm
i tried this command now but it still does not work.

*/5 * * * * sudo sdparm --command=stop /dev/sda1

please help
don't use sudo in cron
use
sudo crontab -e
to make a system cron file
and put the full paths to everything in it
i.e.
*/5 * * * * /sbin/sdparm --command=stop /dev/sda1
or whereever it lives
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Birdybird
Posts: 26
Joined: Tue Sep 10, 2019 12:01 pm

Re: Create cron job

Tue Sep 10, 2019 2:48 pm

It works. Great thank you.

Return to “Beginners”