I'm running Ubuntu server 16.04, that I SSH into.
I am looking for a way to make the watch command monitor multiple things but running into a problem.
I have a working function that monitors my CPU and GPU temps as follows.
temps() {
watch -d -n1 'sensors coretemp-isa-0000 nouveau-pci-0100'
}
This works great giving me this output.
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +35.0c
Core 1: +33.0c
Core 2: +33.0c
Core 3: +34.0c
nouveau-pci-0100
Adapter: PCI adapter
GPU core: +0.86 V
fan1: 780 RPM
Temp1: +41.0c
Power1: 13.26 W
I also have this function that monitors CPU MHz..
mhz() {
watch -d -n1 'cat /proc/cpuinfo | grep "MHz"'
}
This also works great on its own giving me this output
cpu MHz :1600.001
cpu MHz :1600.001
cpu MHz :1600.001
cpu MHz :1600.001
But I want to be able to have one function that will give me both outputs together but I just cant get it to work.
I have tried a few things to combine these two functions into one in my .bashrc so I get one output with both temps and core clocks. but so far watch just gives me errors or a blank screen.
These are some of the things I have tried. (apologies for butchering these commands but i feel just trying on my own is a good way to learn but I've been unsuccessful so far.)
First thing i tried simply just to put them together.
watch -d -n1 'sensors coretemp-isa-0000 nouveau-pci-0100 cat /proc/cpuinfo | grep "MHz"'
This just gives me errors. I have tried many different ways of quoting things to try to get it to work (i know watch is very particular about quoting). When that failed i tried to create variables for the sensors and the cat command but i dont think this was helping me for example i had this..
temp="watch -d -n1 'sensors coretemp-isa-0000 nouveau-pci-0100'"
clock="watch -d -n1 'cat /proc/cpuinfo | grep "MHz"'"
watch -d -n1 $temp $clock
Again failure :(
If anyone can help me work out how to get the watch command to output both so i dont have to have two separate functions I just want to type "temps" into my SSH on my ipad and be able to see my servers temps and core clocks in one output from the watch command.