Simplification. Tom let me know you can spin up all drives via one call
#!/usr/bin/php
<?
function emhttpd($cmd) {
global $state, $csrf;
$ch = curl_init("http://127.0.0.1/update");
$options = array(CURLOPT_UNIX_SOCKET_PATH => '/var/run/emhttpd.socket',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => "$cmd&startState=$state&csrf_token=$csrf");
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
}
$vars = parse_ini_file('/var/local/emhttp/var.ini',true);
$state = $vars['mdState'];
$csrf = $vars['csrf_token'];
echo "Spinning up disks\n";
emhttpd("cmdSpinupAll=apply");
?>