I have written two scripts: one to output vmstat etc and another to stress the system. I had included a link to output the stress statistics to file, but when I go to look for it in the Ubuntu desktop home folder, it says it is not found and when I provide the directories for sftp of
Code:
home/roryhbmc/tmp/stress_cpu_stat_$D
and
Code:
home/roryhbmc/stress_cpu_stat_$D
it tells me that the files are not found. It seems to do this no matter how much I adapt the filename.
Is it therefore not possible to write stress to file? If not, is it possible to run vmstat etc simultaneously to stress? I want to compare the system unstressed to being stressed-is the only way to do this to run vmstat etc first, then run stress on it's own and then vmstat etc again?
Below is the stress script I have at the moment.
Code:
#!/bin/bash
#
# Script to get stress statistics#
echo "How many would you like to stress?"
echo -n "Number of cores being stressed: "
read cores
# the variable "cores" now has the value entered by keyboard
echo "Enter the number of intervals (seconds) for running the stress statistics:"
read seconds_to_run
# the variable "seconds_to_run" now has the value entered by keyboard
D=`/bin/date '+%B.%d'`
#Variable to read the date that the command runs
while true; do
clear
echo "*******************************"
echo "* Choose from the following: *"
echo "*******************************"
echo "* [1] Stress the CPU. *"
echo "* [2] Stress the Memory(RAM). *"
echo "* [3] Stress the disk drive. *"
echo "* [4] Stress the hard disk drive. *"
echo "Press A to quit."
echo "************************"
echo -n "Enter your menu choice [1-4]: "
read choice
case $choice in
1) echo "Stressing the CPU"
stress -c $cores -t $seconds_to_run |tee /tmp/stress_cpu_stat_$D
echo "This file will be saved to /tmp/stress_cpu_stat_$D"
sleep 5 ;;
2) echo "Stressing the Memory(RAM)"
stress -m $cores -t $seconds_to_run |tee /tmp/stress_ram_stat_$D
echo "This file will be saved to /tmp/stress_ram_stat_$D"
sleep 5 ;;
3) echo "Stressing the disk"
stress -i $cores -t $seconds_to_run |tee /tmp/stress_disk_stat_$D
echo "This file will be saved to /tmp/stress_disk_stat_$D"
sleep 5 ;;
4) echo "Stressing the hard disk drive"
stress --hdd $cores -t $seconds_to_run |tee /tmp/stress_hard_disk_stat_$D
echo "This file will be saved to /tmp/stress_hard_disk_stat_$D"
sleep 5 ;;
A) #Quit option
echo You have chosen to quit.
exit;;
*) #Wildcard option in case user enters an invalid option such as "e"
echo Invalid choice, please make another choice
sleep 3;;
esac
done