Profitable Scripting
date: 2023-01-05
Today I did an onsite service call to a business that I have worked with before. The business resells server hardware, including storage drives - SATA and SAS. I had previously configured a Dell PowerEdge R730xd server with 24 2.5 inch SAS drive bays on the front as a drive testing machine.
Their software of choice to test the drives was HD Sentinel, as they had used that before on Windows. HD Sentinel also releases a free Linux version of their software, but the interface is different. The Linux version is meant to be used from the command line.
Hard Disk Sentinel Linux Edition
However, this client was used to using Windows and asked me to install the optional Graphical User Interface (GUI) that someone had made as a front end for HD Sentinel. I did install that GUI for them last month, but it did not work as desired. It seems sluggish and didn't update the drive info quickly. It also didn't give a full report of each drive.
They were tempted to go back to the Windows version, but I convinced them to let me show them what the command line version of the program could do.
After showing them the reporting tool and that it could generate reports in .txt and .html files, they loved it and were excited about how they could use it.
They asked if I could make it easier for their testing technicians to run, so I wrote a shell script on the spot that ran the reports and saved them to both .txt and .html with a $TIMESTAMP in the file name. The final line of the script used called firefox to open the .html version of the report.
#!/bin/sh # Assign and format TIMESTAMP to be used in filenames TIMESTAMP=`date +"%Y-%m-%d-%H-%M"` # Write txt and html reports to disk # sudo is needed to access hardware information sudo /usr/share/bin/HDSentinel -r ~/Desktop/DriveReports/txt/drives-$TIMESTAMP.txt sudo /usr/share/bin/HDSentinel -html -r ~/Desktop/DriveReports/html/drives-$TIMESTAMP.html # Change ownership of the reports to desktop user instead of root sudo chown -R user:user ~/Desktop/DriveReports # Open html report with web browser firefox ~/Desktop/DriveReports/html/drives-$TIMESTAMP.html
They can load that machine with 24 drives and click the icon of the script on the desktop, confirm they want to run it in the terminal, enter the sudo password and reports will be saved for that batch in a specific location with a $TIMESTAMP in the filename and the visual html report will open in firefox.
They can keep doing it and all the reports are automatically saved each time the script is run.
It was a quick script to get them started, but they want me to do more work to build something that will improve their workflow and fit their use case, which includes being able to look up the report of a drive later on after they've sold it.
I haven't done that work yet, but I have some ideas on how to do it.
They were quite happy to pay me before I left and insisted on paying more than the amount I asked for.
I am now scripting for profit.
tags: #linux #programming #bash