Efficiently configuration, test, and manage multiple Linux servers with fh command

Photo by Kelvin Ang on Unsplash

Introduction

I made a tool in bash to deploy to a remote server like Python Fabric.
With a few simple options, you can run commands or run shell scripts against the remote server. You can efficiently configure and test multiple Linux servers.

It is published on GitHub.

Example of using fh command

  • Execute the same command for multiple servers.
  • Automate communication confirmation that is performed many times.
  • Prepare the release work in advance, and only need to execute a few lines in the release.

Features of fh command

(1) Low learning cost (simple)

The fh command is a simple option that you can easily understand by looking at “fh -h”. Almost no preparation required, ready to use

(2) Low environmental dependence

The fh command is made up of shell scripts and is less environment dependent. Just copy and paste the code and it will work anywhere. It should be usable after 10 years.

(3)Easy to solve problems on your own

It’s a shell script that runs, so it’s easy to find out why it didn’t work when something went wrong.

(4)Once you learn, you can apply it to others

The fh command executes a shell script, so it is necessary to be able to write a shell script. IT Engineers need the ability to freely write shell scripts for backups, alerts, and other automation, so let’s master it.

fh command Operation example

The fh command has various options. The basic operation is as follows

Command execution

fh -H host1 -c hostname
#Execute the hostname command on host1
fh -H host1 -p -c hostname
#Execute the hostname command on host1 with password authentication
fh -H host1,host2 -c hostname
#Execute the hostname command on host1 and host2
fh -H hostlist -c hostname
#Execute the hostname command on the host in the host list
fh -H host1 -s -c whoami
#Execute whoami command with sudo for host1
fh -H host1,host2 -s --vi FILE
#Edit files with sudo vi for host1 and host2
fh -H hostlist --ping
#Check the ping for the hosts listed in the host list

Run shell script

fh -H host1 -f test.sh
#Run test.sh on host1
fh -H host1 -f test.sh:cmd_whoami
#Run test.sh on host1.cmd_whoami is an argument

How to install fh command

If you have administrator privileges:
(You don’t need to have administrator privileges because you only need to put one file. Read README.md on GitHub for more information.)

~]$ curl -o fh https://raw.githubusercontent.com/kuritaka/fasthandle2/main/fhscripts/fh.sh
~]$ chmod 755 fh
~]$ sudo mv -i fh /usr/local/bin/
~]$ which fh
/usr/local/bin/fh
~]$ fh -h

If you want to use the fh command for password authentication, you need to install sshpass.

Help messages of fh command

Conclusion

Do you like the fh command?
It’s ready to use, so let’s try it first.
Please read README.md on GitHub for more information.

--

--

--

Server/Network/Storage at Trading Systems | Low Latency (https://cmdref.net/)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

Blinking light on ESP32

AutoScaling CloudFormation Template with Lono

Builder Pattern with Java Lombok

7 Carthage Terminal Commands to Bookmark

How to perform AWS security best practices assessments, incident response and forensics readiness…

Another Audit is passed!!

Simple Spring Boot Service to Kubernetes Application: Step 17

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Takaaki Kurihara

Takaaki Kurihara

Server/Network/Storage at Trading Systems | Low Latency (https://cmdref.net/)

More from Medium

How I build a crypto bot with Python, Docker, Rancher, Azure Devops and ArgoCD

Docker Basics: Windows Host Volumes

Running Commands behind Proxy

Ingesting and processing multiple lines in Linux using an array and loops.