Check These Out
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
*I run this with byobu as as a custom status bar entry that runs every 10 seconds by putting it in a script here:
$ .byobu/bin/10_update_windows
There's no output to stdout, so nothing is displayed on the status bar.
*Presumes that #{pane_title} is set to the hostname or prompt containing the host name. In my case, it's in this format:
$ $USER@$HOSTNAME:$PWD
The sed commands may need to be modified if your pane_title is different.
*If you want to strip out a common part of a hostname, add the following before '| uniq'
$ -e 's/[COMMON PART]//'
I use that to strip out the domain of the servers I connect to, leaving the subdomain.
I've been using linux for almost a decade and only recently discovered that most terminals like putty, xterm, xfree86, vt100, etc., support hundreds of shades of colors, backgrounds and text/terminal effects.
This simply prints out a ton of them, the output is pretty amazing.
If you use non-x terminals all the time like I do, it can really be helpful to know how to tweak colors and terminal capabilities. Like:
$ echo $'\33[H\33[2J'
This will list the files in a directory, then zip each one with the original filename individually.
video1.wmv -> video1.zip
video2.wmv -> video2.zip
This was for zipping up large amounts of video files for upload on a Windows machine.
Maybe this will help you to monitor your load balancers or reverse proxies if you happen to use them. This is useful to discover TIME OUTS and this will let you know if one or more of your application servers is not connected by checking.
This loop will finish if a file hasn't changed in the last 10 seconds.
.
It checks the file's modification timestamp against the clock.
If 10 seconds have elapsed without any change to the file, then the loop ends.
.
This script will give a false positive if there's a 10 second delay between updates,
e.g. due to network congestion
.
How does it work?
'date +%s' gives the current time in seconds
'stat -c %Y' gives the file's last modification time in seconds
'$(( ))' is bash's way of doing maths
'[ X -lt 10 ]' tests the result is Less Than 10
otherwise sleep for 1 second and repeat
.
Note: Clever as this script is, inotify is smarter.