r/bash•
Slash_Root

Wrote My First Production Script - A Thank You

Hi all,

I hope this is allowed. It looks like it is based on the sidebar but let me know if not. I have had my RHCSA for about a year and am about to start my first linuxadmin job next week. I have written several scripts to automate my homelab as well as a few pet projects. I lurk heavily both here and in the #bash IRC channel on freenode.

At my current job, I replaced our aging, insecure monitoring system with a FOSS one based on nagios/icinga2 to save money. We had a need for a specialized check that no plugin seemed to offer. I wrote the check today, it wraps wmic to check for disk space based on a scale (according to disk size) and notifies the team if the disk is too full for its size. Nothing too crazy, just some text parsing, loops, and conditionals.

It is complete with error handling, command line options, and helpful usage information. I wrote the configs to wrap the script and was really shocked at how quickly it came together after following the conversations here. I know it is nothing too special, I am just excited as it is the first script I have written, outside of Powershell, that will see real use.

I just wanted to thank this community for all the knowledge I have gleaned recently. It is an amazing feeling to do something remotely useful with it. I am sure that, in my new role, I will be grepping, cutting, and sorting in no time.

Thanks all, keep gluing stuff together with Bash!

Posted Nov 5, 2019, 3:23 AM UTC

273
gstlouis•

If you do email systems you should also check out pflogsumm for email report. Built in pearl I beleive.

3
mro21•

*Perl

2
Slash_RootOP•

Thanks, I haven't heard of that one. I will check it out.

1