You are not logged in.

#1 2017-08-08 14:49:51

arnaudv6
Member
Registered: 2016-02-25
Posts: 73

[bash script] taskmanager

I would very much like to share another bash script, aside m.
And that is a barebones taskmanager.
https://github.com/Arnaudv6/taskmanager
I hope you like it.

Why ?

  • for the sake of better keyboard workflow, over top, and htop.

  • because qps is dead and not forked yet.

  • because I feel a console script is up to the task.

I will welcome any feedback:

  • on ergonomics/workflow

  • on code because let's face it, I am a hobbyist, and not so senior one.

Specifically, I have no reliable location to find CPU temperatures:
I have set a practical location that works on my gentoo system. Any ideas?

I am on vacation for 2 weeks in a few days but will try to keep up with comments from my smartphone.

edit:typo smile

Last edited by arnaudv6 (2017-08-08 14:51:53)

Offline

#2 2017-10-03 19:13:06

brainfucksec
Member
Registered: 2017-03-01
Posts: 40
Website

Re: [bash script] taskmanager

I try the script and CPU temperature is displayed correctly, if I do not mistake the path "/sys/devices/platform/coretemp.0/hwmon/hwmon0" is the same used by "lm sensors": https://wiki.gentoo.org/wiki/Lm_sensors

sensors | grep Core

Core 0:       +40.0°C  (high = +76.0°C, crit = +100.0°C)

Good idea the switch with Tab key

Last edited by brainfucksec (2017-10-03 19:20:18)


--= [ |<!55 ]=--

Offline

#3 2017-10-06 14:54:07

arnaudv6
Member
Registered: 2016-02-25
Posts: 73

Re: [bash script] taskmanager

Hey, thanks brainfucksec, your experience is much valuable.
It's been awfully calm on the thread, and I sincerely hope that this is not entirely due to massive mortal shocks of people reading through my code.

I was wondering if maybe this path would be sort-of more standard?
/sys/class/thermal/thermal_zone*/temp
Thanks for your point on Lm_sensors: I can not be all wrong then.
You are refering to a gentoo page: are you using gentoo please?
Because so am I. And this being an arch forum, I should like to know that the script works in arch too.

As a side-note, QPS finally could make a release (https://github.com/QtDesktop/qps/issues/14).
I will stick to my script anyway.

Offline

#4 2017-10-06 17:38:46

brainfucksec
Member
Registered: 2017-03-01
Posts: 40
Website

Re: [bash script] taskmanager

Hi arnaudv6, the directories under "/sys/class/thermal" aren't always the same, for example in this directory I have two symlinks:

cooling_device0
cooling_device1

these symlinks bring to these directories relative to the motherboard fans:

../../devices/virtual/thermal/cooling_device0
../../devices/virtual/thermal/cooling_device1

Also the three structure under sys/ aren't always the same, this directory is relative to Sysfs "virtual file system" and contains informations about the hardware devices and kernel drivers, the speech about Sysfs is complex, you can read other informations here:

https://en.wikipedia.org/wiki/Sysfs

http://opensourceforu.com/2015/05/talki … ugh-sysfs/

https://lwn.net/Articles/646617/

Furthermore this story bring us to the speech of "hardware health monitoring chips" if you are interested you can read more here: https://hwmon.wiki.kernel.org/faq
About your program, I suggest you to use a "main()" function, if you enclose all the functions in the main you have more control over the program's flow, read these good sources:

About best practices --> https://github.com/progrium/bashstyle

and about error handling --> http://www.davidpashley.com/articles/wr … l-scripts/

Last edited by brainfucksec (2018-08-16 09:01:23)


--= [ |<!55 ]=--

Offline

#5 2017-11-04 17:29:31

arnaudv6
Member
Registered: 2016-02-25
Posts: 73

Re: [bash script] taskmanager

Hi brainfucksec, thanks for taking the time. That is quite a load of reading and will take me some time.
Meanwhile I have refactored the code against spellcheck.
It is on the way to having a main function and handling errors.
I also added [shift]+[tab] binding to cycle through in reversed order.

Offline

Board footer

Powered by FluxBB