This article focuses on the BIOS configuration for the Dell Server RACADM environment, with an example of F1/F2 error hints and hard drive boot order changes. Racadm Basic usage can refer to the previous article.
#!/bin/bash# Sly chen# date:2016-09-14idrac_ip=$1user= ' root ' passwd= ' Calvin ' # RACADM general syntax defined as variable command= "Racadm-r ${ IDRAC_IP}-U $USER-P $PASSWD "# Get Controller controller=$ ($COMMAND storage get Controllers--nocertwarn | sed ' s/\r/\n/g ' | egrep "RAID") # Current Job Count jobs=$ ($COMMAND jobqueue View--nocertwarn | sed-n '/---/, $p ' | wc-l) # display function red () {ECHO-E "\033[31;40m$*\033[0m"}# show function Green () {ECHO-E "\033[32;40m$*\033[0m"}function sys_reboot {# define Physical machine restart function $COMMAND serveraction powercycle--nocertwarn &>/dev/null if [$?-eq 0]; Then echo "${IDRAC_IP}: Server powercycle success" Else Red "${IDRAC_IP}: Server Powercycle false" Exit Fi}function Jobdel () {# delete all job records echo "${idrac_ip}: Start Jobqueue delete." While [${jobs}-ne 2]; Do racadm-r ${idrac_ip}-u ${user}-P ${passwd} jobqueue delete--all--nocertwarn &>/dev/null loca L jobs=$ ($COMMAND jobqueue View--nocertwarn | sed-n '/---/,$P ' | WC-L) Done echo "${IDRAC_IP}: Jobqueue delete success."} Functions get_job_id () {# This function is used to determine the percentage of task jobs, when 100% confirms job completion # enables LC $COMMAND set LIFECYCLECONTROLLER.LCATTRIBUTES.LIFEC Yclecontrollerstate 1 &>/dev/null # Job Progress 100% exit the Dead loop while true; Do # get job progress percent job_percent=$ (${command} jobqueue View--nocertwarn | egrep-a7 "$JOBID" | awk-f "=" '/perce NT complete/{print $} ' | Sed ' s/\r//g ') if [-Z ' $JOB _percent "]; Then red ' ${idrac_ip}: Jobqueue is empty ' exit elif echo $JOB _percent | Egrep ' &>/dev/null; Then the break fi sleep did Echo "${IDRAC_IP}: Jobqueue create success."} function Jobsub_bios () {# Submit BIOS task echo "${IDRAC_IP}: Jobqueue create BIOS. Setup, may be need 15min. Start Time: $ (date +%y-%m-%d-%h:%m:%s) "# Submit BIOS Job local jobid=$ ($COMMAND jobqueue Create Bios. Setup.1-1--nocertwarn | awk '/commit Jid/{print $4} ' | Sed ' s/\r//g ') [-Z ' $JOBID '] && Red "${IDRAC_IP}: Did not get the JID" && exit ${command} serveraction powercycle--nocertwarn &am p;>/dev/null # Determine job percentage get_job_id ${idrac_ip} echo "${idrac_ip}: BIOS. Setup task Jobsub done}# Job submitfunction jobsub () {echo ' ${idrac_ip}: Jobqueue Create hard disk task, could be need 15min. Start Time: $ (date +%y-%m-%d-%h:%m:%s) "# Submit array job, get job Jid local jobid=$ ($COMMAND jobqueue Create ${controller} -S time_now-r Forced--nocertwarn | awk '/commit Jid/{print $4} ' | Sed ' s/\r//g ') # JID empty Then exit [-Z ' $JOBID] && red "${IDRAC_IP}: Did not get the JID" && exit ${com Mand} serveraction powercycle--nocertwarn &>/dev/null # Estimate job percentage get_job_id ${idrac_ip} echo "${idrac_ip} : BIOS Controller Task jobsub done "}function disable_error_prompt {# BIOS f1/f2 errprompt echo" ${idrac_ip}: Start Disable Errprompt "$COMMAND set BIOS. Miscsettings.errprompt Disabled &>/dev/null echo "${idrac_ip}: ERrprompt disabled Done "}function Set_hard_disk_first_boot () {# Remove all boot device reordering, sort command compares first character by default, disk boot takes precedence over Nic Boot_drives_ list=$ ($COMMAND get BIOS. Biosbootsettings.bootseq | Awk-f ' [=] '/bootseq/{print ' | Sed ' s/\r$//;s/,//g ' | Xargs-n 1 | Sort | Xargs-n 9 | Sed ' s//,/g ') $COMMAND set BIOS. Biosbootsettings.bootseq $BOOT _drives_list &>/dev/null}function Bios_setup_check () {# define BIOS check function Err_promp t_statu_chk=$ ($COMMAND get BIOS. Miscsettings.errprompt | Awk-f ' = '/errprompt/{print $} ' | Sed ' s/\r$//') # errorprompt status is not Disabled error if ["$ERR _prompt_statu_chk" = = "Disabled"]; Then Green "${idrac_ip}: BIOS f1/f2 error Prompt is Disabled." else Red "${idrac_ip}: BIOS f1/f2 error prompt is Enabled" Exit fi first_boot_name_chk=$ ($COMM and get BIOS. Biosbootsettings.bootseq | Awk-f "[=.]" '/bootseq/{print $} ' | Sed ' s/\r$//') # The first boot is not harddisk error, if there is a CD-ROM boot, the sort needs to be moved backwards if ["$FIRST _boot_name_chk" = = "HArddisk "]; Then Green "${idrac_ip}: After Testing,hard disk first boot." else Red "${IDRAC_IP}: The boot sequence: ${first_boot_name_chk}" exit Fi}function Main () {Jobdel ${i DRAC_IP} # Gets the first boot item device name first_boot_name=$ ($COMMAND get BIOS. Biosbootsettings.bootseq | Awk-f "[=.]" '/bootseq/{print $} ' | Sed ' s/\r$//') # Gets the Errprompt item status err_prompt_statu=$ ($COMMAND get BIOS. Miscsettings.errprompt | Awk-f ' = '/errprompt/{print $} ' | Sed ' s/\r$//') # If the BIOS is currently set to the first boot of the hard disk and the F1/F2 error is disabled, exit, otherwise execute the change function if ["$FIRST _boot_name" = = "Harddisk"-A "$ERR _ Prompt_statu "= =" Disabled "]; Then echo ' ${idrac_ip}: BIOS f1/f2 Errot prompt default is Disabled ' echo ' ${idrac_ip}: Hard disk drive DEFA Ult is the first boot "exit Elif [" $FIRST _boot_name "! =" harddisk "-a" $ERR _prompt_statu "= =" Disabled "]; Then Set_hard_disk_first_boot echo "${idrac_ip}: BIOS f1/f2 Errot prompt default is Disabled" Jobsub_ BIOS ${iDRAC_IP} elif ["$FIRST _boot_name" = = "Harddisk"-a "$ERR _prompt_statu" = = "Enabled"]; Then echo ' ${idrac_ip}: Hard disk drive default is the first boot "disable_error_prompt Jobsub_bios $ {IDRAC_IP} elif ["$FIRST _boot_name"! = "harddisk"-a "$ERR _prompt_statu" = = "Enabled"]; Then Set_hard_disk_first_boot disable_error_prompt Jobsub_bios ${idrac_ip} else Red "${idra C_IP}: Get Bios valus Error "Exit 3 fi bios_setup_check ${idrac_ip}}main ${idrac_ip}
Server BIOS settings for the RACADM Environment (iii)