Sponsored Content
Top Forums Shell Programming and Scripting Code that has to end no matter what Post 303022485 by drew77 on Saturday 1st of September 2018 05:32:12 PM
Old 09-01-2018
It did not cause a reboot, but the stress test never ended resulting in an unchecked rise in my cpu temp.

I made some corrections.

Code:
#!/bin/bash
# Ubuntu_Mate 18.04 LTS
#-----------------------------------
# Much help from https://www.unix.com/shell-programming-and-scripting/
# https://ubuntuforums.org/ https://askubuntu.com/ https://ubuntu-mate.community                                 
#                                 
# don't use ALLCAPS for variable names
#-----------------------------------

LogFile="/home/andy/bin/CPU_Stress_Test.txt"
maxruntime=15s
command=(/usr/bin/stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout "$maxruntime")
# remove logfile if it exists
if [ -f "$Scripts" ];
then
rm $Scripts
fi

"${command[@]}" & watchpid=$!

date +"%Y-%m-%d-%H:%M:%S" >> $LogFile
sensors -f | grep "temp4" >> $LogFile
sensors -f | grep "fan1" >>  $LogFile

/bin/sleep "$maxruntime"

if [ -d "/proc/$watchpid" ]
then
        echo "Max runtime exceeded, killing PID $watchpid"

        if /bin/kill -9 "$watchpid" >/dev/null 2>/dev/null
        then
                echo "Killed."
                exit 0
        else
                echo "Could not kill, please investigate manually."
                exit 1
        fi
fi
date +"%Y-%m-%d-%H:%M:%S" >> $LogFile
sensors -f | grep "temp4" >> $LogFile
sensors -f | grep "fan1" >>  $LogFile

 

5 More Discussions You Might Find Interesting

1. Linux

Need help with this matter

I have a PC that was built in Europe pre-installed with Windows 2000. The HDD is 40GB, but, its split up as two 20GB (Taken up by Windows). I want to take over my Mandrake 9.1 CDs and install Linux on that machine. My question is, how would I proceed to install Linux this way??? Now, If... (1 Reply)
Discussion started by: wardialer
1 Replies

2. Shell Programming and Scripting

How to delete matter in between two lines

help I am having text file like this... ------------------------END OF UPDATION ------------------ xxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyy 1 row updated ------------------------END OF UPDATION ------------------ TTTTTTTTTTTTTTTT FFFFFFFFFFFFFFFFF ... (3 Replies)
Discussion started by: suryanarayana
3 Replies

3. Shell Programming and Scripting

Terminal to the front no matter what

Is there a way to bring the terminal script to the front? I am running this script through OMCEdit which is then running it through Terminal. I have some dialog boxes (using osascript) and the dialog boxes are not coming to the front...Terminal bounces and I have to click on Terminal to see the... (1 Reply)
Discussion started by: mainegate
1 Replies

4. Shell Programming and Scripting

grep matter between braces

#include<header.h> void classname :: pvvd_init ( abcd ,efgh ,ijkl ,mnop ) { rvcl_tabl_name_tabl.pvvd_init ( xxxx ,"tabl_mame" ) ; ... (2 Replies)
Discussion started by: ultimatix
2 Replies

5. UNIX for Dummies Questions & Answers

Strange system activity no matter what I try

When I choose to encrypt my drive during a Linux install, it encryps it, but I receive errors in dmesg and in ~/.xsessions-errors during use. The first error is in dmesg where it sometimes shows errors writing to the encypted device. The second error is in ~/.xsessions-errors with an error about... (0 Replies)
Discussion started by: justgoogleit
0 Replies
sensors(1)							Linux User's Manual							sensors(1)

NAME
sensors - printing sensors information SYNOPSIS
sensors [ options ] [ chips ] DESCRIPTION
sensors is used to show the current readings of all sensor chips, and to set all limits as specified in the configuration file. sensors knows about certain chips, and outputs nicely formatted readings for them; but it can also display the information of unknown chips, as long as libsensors knows about them. OPTIONS
-c config-file Specify a configuration file. If no file is specified, the name `sensors.conf' is used. If the name does not contain a directory slash, or this parameter is not present, the following path is examined: /etc, /usr/lib/sensors, /usr/local/lib/sensors, /usr/lib, /usr/local/lib, . -h Prints a help text -s Evaluates all `set' statements in the configuration file. You must probably be `root' to do this. If this parameter is not speci- fied, no `set' statement is evaluated. -A Do not show adapter and algorithm for each chipset. -u Treats all chips as unknown ones. Output will be of much lower quality; this option is only added for testing purposes. -v Returns the program version. -f Prints the temperatures in degrees Fahrenheit instead of Celsius. FILES
/etc/sensors.conf The system wide configuration file. See sensors.conf(5) for further details. CONFORMING TO
lm_sensors-2.x SEE ALSO
sensors.conf(5) June 2, 2002 sensors(1)
All times are GMT -4. The time now is 09:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy