/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>amazon ec2 - AWS, EC2 Instance, Windows, Userdata not able to set disk online with script - Stack Overflow|Concepts Of Algorithm

amazon ec2 - AWS, EC2 Instance, Windows, Userdata not able to set disk online with script - Stack Overflow

admin2025-03-19  9

I have EC2 instance with template on cloudformation on AWS and if anything fails or instance is terminated my template created new instance with latest EBS backup. But this attached voleme to newly created instance is not online on the server(windows). I tried 2 different userdata scripts for setting mz volume online and none of this works. Can anyone help me where i'm doing misstake:

This is my old code

$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
sleep 5
Set-Disk -InputObject $(Get-Disk -Number 1) -IsReadOnly $false
echo "Volume - $volumeId back ONLINE."

This is my new code

$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
echo "Disk $secondDisk is now online."
Set-Disk -InputObject (Get-Disk -Number $secondDisk) -IsReadOnly $false
echo "Disk $secondDisk is no longer ReadOnly."
echo "Disk $secondDisk is now ready to be used with existing data."

Thanks for advice

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742363547a209754.html

最新回复(0)