“Fixing” troublesome filenames.

Windows has a number of reserved characters that aren’t allowed in file/folder names: ◦The following reserved characters: ◾< (less than) ◾> (greater than) ◾: (colon) ◾” (double quote) ◾/ (forward slash) ◾\ (backslash) ◾| (vertical bar or pipe) ◾? (question mark) ◾* (asterisk) I’d also advise against the use of curly braces {} The following … [Read more…]

“Nesting” Variables in bash

Many thanks to “Gavin Smith” on stackoverflow.com for the first part of this tip. Expressions like ${${a}} do not work. To work around it, you can use eval: b=value a=b eval aval=\$$a echo $aval Output is value Thanks for the tip Gavin! Ok, so why would you want to? For me, I needed to test … [Read more…]

Checking SSL Expiry Dates From The Command Line

This is a simple way to check your sites SSL certificate expiry date from the command line. I’ll probably expand the script to work with lists and to send alerts if under XX days are remaining, but for now it just works with ./ssl_exp.sh your.domain.name #!/bin/bash DOMAIN=$1 EXPIRES=$(echo | openssl s_client -connect ${DOMAIN}:443 2>/dev/null | … [Read more…]

Advanced Bash Scripting

This is really more of a tip, if you’re in any way serious about doing and scripting in BASH then you really need the Advanced Bash Scripting guide from the Linux Documentation Project.  This is my “go to” guide whenever I need to check syntax of commands, tests, loops, etc.  The PDF is always living … [Read more…]

MySQL Backup

This is a simple script that can be used to take backups of your MySQL databases, it can be run as a cron job and outputs enough of a log to allow you to keep track of what’s going on. There’s a few sections you’ll need to edit and an extra stage that uses rsync … [Read more…]