VMware FAH Appliance: Making Of F@H-Stats

This post was published 4 years 1 month 1 day ago, so the post may be outdated.

You might have seen my previous blog post about the VMware Appliance for Folding@Home. This article is about how the local console was made underneath – and actually how simple it is.

Usually when powering on a Linux-based operating system, you just get the usual login console after boot. I thought that it would be handy to see what or if something is ongoing without actually logging in – so in other words: Seeing how busy the virtual machine is, and what the Folding@Home software is doing.

So I went ahead figuring out a simple, fast and easy way showing both. Ending up with the idea: Using a terminal multiplexer, and showing the classic top and tail -f /var/lib/fahclient/log.txt.

That’s how it looks like (when Enable F@H Stats in VM Console was enabled during deployment):

Local Console / F@H Stats

This is how it works…

How it works

1. First of all, make sure to install tmux on your machine first.
On PhotonOS that’s done by running tdnf install -y tmux. (see tdnf docs)

2. Prepare a small script to start tmux. (nano /root/tmux.sh, or vi)

#!/bin/sh
tmux new-session -d 'top'
tmux split-window -p 10 -v 'tail -f /var/lib/fahclient/log.txt'
tmux -2 attach-session -d

This starts a new tmux session with top, then splitting the window horizontally with 10% height where the tail command is run. Then we basically attach to the newly created tmux session… Voila, we have our simple overview!

3. Make the above script executable by using:

chmod +x /root/tmux.sh

4. Configure the script being called upon boot and shown instead of login console
Note: This steps are designed for Linux distributions taking use of systemd.

$ mkdir -p /etc/systemd/system/getty@tty1.service.d/
$ cat > /etc/systemd/system/getty@tty1.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=-/root/tmux.sh
StandardInput=tty
StandardOutput=tty
EOF

5. Apply changes
Here you can either reboot to test, or reload systemd and restart getty on a different terminal:

$ systemctl daemon-reload
$ systemctl restart getty@tty1.service

Resources which helped a lot:

Patrik Kernstock

May I introduce my self? I am Patrik Kernstock, 25 years old, perfectionist, born in Austria and living in Ireland, Cork. Me explained in short: Tech- and security enthusiast, series & movies junky. Interesting in Linux, Container-stuff and many software solutions by Microsoft, Veeam and VMware.

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x