Hi everyone! Hoping someone can help with this. It’s an extremely simple crontab execution , but doesn’t run under UCS.
I have a command to set sleep and idle time parameters on a second HDD. I’ve tried adding this to crontab logged into the root user via “crontab -e” , the line is @reboot hdparm -B127 -S120 /dev/disk/by-id/ata-ST4000LM024-2AN17V_WCK1P3C7
When that didn’t work, I also tried adding it in the form of a script under /etc/cron.hourly and also added it to the crontab just to see if either or both would work…
crontab line is: @reboot echo /etc/cron.hourly/DiskStandby.sh | at now + 2 minutes
Unfortunately, it doesn’t run at boot and doesn’t run hourly. Yet the script runs fine manually and the command runs fine in terminal separately.
I’m not hard set on using cron jobs… if there’s another way in the UCS, I’m open to other options.
Note: you can check the status (or errors) using the command
systemctl status rc-local.service
Note: a little side effect is the disk I intended to sleep after 10min of idle time now starts in sleep at boot, when the service starts. Not a bad side effect, it’s actually fine. It wakes on data requests and goes back to sleep after 10min of idle. so, I’m happy with it
Just for completeness, did the script DiskStandby.sh contain a shebang for the shell? ("#!/bin/bash") or did you define SHELL in the crontab? Is the script executable? Did you try with the full path to “at” or did you define PATH in the crontab?
Yes, the script contained a shebang for the shell. I found out it’s more of a drive specific / firmware issue. I’m using a Seagate 4TB 2.5" as an extra backup. Just found out that it doesn’t like being set at anything lower than -B254. Oddly the idle timer set via “-S120” works fine when Power management is set at “-B254”.