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):
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 /email@example.com/ $ cat > /firstname.lastname@example.org/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 email@example.com
Resources which helped a lot: