I’m partaking in the Mongol Rally 2016 where we will be driving our Black Beauty (pictured) over 10,000 miles (16,000 kms) through Countries, Cities and Sea. Lets trek over mountains, explore deserts and meet and greet all the people in between!

I ran into a situation where I wanted to run a custom bash on first launch of a VM built from template. I wanted this script to be able to ask for certain variables from the user in order to configure the systems DNS, NTP, Red Hat Satellite activation key, IP address and hostname.

In order for the script to run on boot, I added the script location into rc.local

When booting however, keyboard response was poor and there was no response/echo of the typed characters from the read (even though -s wasn’t specified).

Found this problem to be with plymouth running during boot startup for GIU fluidity.

Simply adding “plymouth quit” in my script solved this issue. Below is a sample of the script for clarity:

Firefox has implemented a more secure method when encompassing unsigned SSL certificates. This may be a pain at first glance, however adding more steps in order to bypass invalid SSL certificates surely is a good thing.

The message you may receive is:

This Connection is Untrusted
You have asked Firefox to connect securely to srv-qs-revm.lands.nsw, but we can't confirm that your connection is secure.
Normally, when you try to connect securely, sites will present trusted identification to prove that you are going to the right place. However, this site's identity can't be verified.
What Should I Do?
If you usually connect to this site without problems, this error could mean that someone is trying to impersonate the site, and you shouldn't continue.
srv-qs-revm.lands.nsw uses an invalid security certificate. The certificate is not trusted because the issuer certificate is not trusted. (Error code: sec_error_untrusted_issuer)

To resolve this issue, in the Tools menu select select Options

Select the Advanced tab then the Certificates tab and click on the View Certificates button:

Select the Servers tab and click the Add Exception button:

Finally, enter in the URL and click the Get Certificate button, followed by Confirm Security Exception button. Then OK out and refresh the page.

As I have multiple websites which I like to utilise AWStats for (there are still benefits to server based logging over Google Analytics, however I like to use them together) I scp all of the Apache/httpd log files onto my awstats server. Below is a little PHP page which parses the AWStats config directory to generate an index page to make it easier to identify and navigate to each statistics page.

In a logrotate conf there are the options of prerotate and postrotate where you can place scripts to be run. The only issue is in most logrotate confs it applies to multiple files and therefore the prerotate and postroate scripts are run multiple times (for each occurrence of each file to be rotated).

I had the situation where I wanted the prerotate to scp apache/httpd access logs to a central AWStats server prior to rotating, and I only wanted the scp to occur once. The only method I identified to work was to create a kind of pid file, or temp file, and check for its existence. Below is the code incase anybody else requires a similar solution:

vim /etc/logrotate.d/apache

#-------------------------------------------------
# Log rotation for /usr/local/apache
#-------------------------------------------------
/usr/local/apache/logs/*log {
daily
rotate 10
missingok
compress
notifempty
prerotate
#Unfortunately prerotate script is run on each occurrence which meets the above *log
#search therefore in order to not have the files scp'd multiple times I have to
#create a temp file for today and check for its existence
today=$(date +"%y-%m-%d")
filename="/usr/local/apache/logs/logrotate$today"
if [ ! -f "$filename" ]; then
#This should only be run once as the file is created later
scp /usr/local/apache/logs/*access_log awstats1:/usr/local/awstats/importLogs/$HOSTNAME/.
#Remove yesterdays temp file
rm -f /usr/local/apache/logs/logrotate*
#Create todays temp file to fail this if clause on subsequent iterations
touch $filename
fi
endscript
postrotate
/usr/local/apache/bin/apachectl graceful
endscript
}