Please see this page for more info about SunVTS
#!/bin/sh #set -x ## variable VTSPATH=/usr/sunvts/bin LOGFILE=/tmp/SunVTS.LOG DATE=`date +'%Y-%m-%d_%H:%M:%S'` # error function err(){ echo "\n ERROR: $* \n" ; exit 1 } # check if user is a root if [ `id | cut -d= -f2 | cut -d\( -f1` = 0 ] then # user is root sleep 1 else korisnik=`id | cut -d= -f2 | cut -d\( -f2 |cut -d\) -f1` echo echo You are NOT root. You are $korisnik so cannot run script - sorry ... echo fi #################################################### ## Check if required SunVTS packages are installed #################################################### for pkg in SUNWvts SUNWvtsmn SUNWvtsr SUNWvtss SUNWvtsts do /usr/bin/pkginfo ${pkg} 1>/dev/null || err "The package ${pkg} is not installed." echo "Okay: ${pkg} installed" done ########################################## # check if SunVTS is running on the system ########################################## /usr/bin/pgrep vtsk > /dev/null if [ "$?" -ne "0" ] then echo "\n The SunVTS is installed and it is not running on the system in this moment!" else echo "\n Seems that SunVTS is running on this system. The PID id `/usr/bin/pgrep vtsk`. \ Please check this. The script will exit now." ; exit 1 fi ## Inputs # Duration of test echo echo "\n For how long do you want to run the SunVTS test [in days - must be full day]?" echo read DAY # convert duration from hours to minutes DURATION=`expr ${DAY} \* 24 \* 60` # Test mode echo; echo "\n Please enter test mode [ Online Stress, System Exerciser, Component Stress ]" echo "\n ----------------------------------------------------------------------------------" echo; echo "\n Online Stress: Will validate h/w without having significant impact on running applications!" echo; echo "\n System Exerciser: Will test system as whole with all components. All tests will run in parallel. No other applications should run during test time." echo; echo "\n Component Stress: Will do targeted testing of components. Will do maximum stress on component. Test will not run in parallel. No other applications should run during test time." read TMODE # Error Limit echo; echo "\n Please enter number of errors that will cause test to terminate." read ERRORLIMIT # test session name echo; echo "\n Please enter name of SunVTS test session, for example hostname-session-1" echo; echo "\n If session already exist, it will be overwritten!" read SESSION # What components to test echo "\n Please enter do you want to test next components:" echo "\n Disk [y/n]" read DISK echo "\n Interconnect [y/n]" read INT echo "\n Ioports [y/n]" read IO echo "\n Media [y/n]" read MEDIA echo "\n Memory [y/n]" read MEM echo "\n Network [y/n]" read NET echo "\n Processor [y/n]" read PROC # start SunVTS in CLI echo "\n Starting SunVTS in CLI ...." ${VTSPATH}/startsunvts -c # reset number of pass/error from possibly previous tests echo "\n Reset number of pass/error from possibly previous test" ${VTSPATH}/vts_cmd reset || exit 1 # Probes all devices and update SunVTS kernel echo "\n Probes all devices and update SunVTS kernel ...." ${VTSPATH}/vts_cmd reprobe || exit 1 if [ ${DISK} != "y" ]; then echo "\n Disabling test on Disk" ${VTSPATH}/vts_cmd disable_test Disk || exit 1 else echo "\n Setting test options for Disk" ${VTSPATH}/vts_cmd set_test_options Disk \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${INT} != "y" ]; then echo "\n Disabling test on Interconnect" ${VTSPATH}/vts_cmd disable_test Interconnect || exit 1 else echo "\n Setting test options for Interconnect" ${VTSPATH}/vts_cmd set_test_options Interconnect \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${IO} != "y" ]; then echo "\n Disabling test on Ioports" ${VTSPATH}/vts_cmd disable_test Ioports || exit 1 else echo "\n Setting test options for Ioports" ${VTSPATH}/vts_cmd set_test_options Ioports \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${MEDIA} != "y" ]; then echo "\n Disabling test on Media" ${VTSPATH}/vts_cmd disable_test Media || exit 1 else echo "\n Setting test options for Media" ${VTSPATH}/vts_cmd set_test_options Media \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${MEM} != "y" ]; then echo "\n Disabling test on Memory" ${VTSPATH}/vts_cmd disable_test Memory || exit 1 else echo "\n Setting test options for Memory" ${VTSPATH}/vts_cmd set_test_options Memory \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${NET} != "y" ]; then echo "\n Disabling test on Network" ${VTSPATH}/vts_cmd disable_test Network || exit 1 else echo "\n Setting test options for Network" ${VTSPATH}/vts_cmd set_test_options Network \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi if [ ${PROC} != "y" ]; then echo "\n Disabling test on Processor" ${VTSPATH}/vts_cmd disable_test Processor || exit 1 else echo "\n Setting test options for Processor" ${VTSPATH}/vts_cmd set_test_options Processor \ [Stress:high,Scheduling Policy:Test Time,Test Time:${DURATION},Error Limit:${ERRORLIMIT}] || exit 1 fi # set global options echo "\n Setting global testing options" ${VTSPATH}/vts_cmd set_global_options \ [Duration of Testing:${DURATION},Verbose:Enable,Duration of Logging:${DURATION}] || exit 1 # check global options echo "\n Checking global options" ${VTSPATH}/vts_cmd get_global_options || exit 1 echo " \n Are global options okay?" echo " \n Hit ENTER to continue or Ctrl.C to abort ***" echo " \n ... waiting for response ..." read xxx # save session echo "\n Saving session ${SESSION}" ${VTSPATH}/vts_cmd save_session [overwrite:yes,defaultMode:${TMODE},name:${SESSION}] || exit 1 # load session echo "\n Loading session ${SESSION}" ${VTSPATH}/vts_cmd load_session [overwrite:yes,defaultMode:${TMODE},name:${SESSION}] \ || exit 1 # start all enabled tests echo "\n Start all enabled tests" ${VTSPATH}/vts_cmd start || exit 1 # check session echo "\n Listing loaded and running session" ${VTSPATH}/vts_cmd get_session_name || exit 1 # give 15 sec to system to start testing components echo "\n Please wait 15 sec for tests to start on all selected components ....." sleep 15 # check test status echo "\n Check test status ..." ${VTSPATH}/vts_cmd get_status || exit 1 # check that tests are running echo "\n Tests are running ...." ${VTSPATH}/vts_cmd list_tests || exit 1 echo; echo "\n Please check results in ${DAY} days!" echo; echo "\n Use the command ${VTSPATH}/vts_cmd list_tests" exit 0 |