UPDATE 4TH March ’14
The method described in this article is over 3 years old and doesn’t work properly with recent versions of CKEditor but Simon Georget has improved this implementation for CKEditor 4.2.2 and you can find it on Github here.
I have an ESXi host in my office with a RAiD10 array that has around 925GB in capacity – 95% unused. I have a couple of VMs on it that hardly use any of that space and I wanted to make use of all the spare storage space to make a backup of our family photos which were previously stored on two 500GB external drives and take up over 700GB. That’s quite a lot isn’t it? … you might say. Well, I agree, but my wife is rather trigger happy and loves to take 10 slightly different versions of the same shot so that she can choose the best one…. unfortunately the choosing of the best ones rarely involves deleting more than 1 out of each 10 of what was taken, hence the monstrously large library. Ah well!
I had a log directory with over 15000 entries from a period of over two years. My task was to move all but the most recent logs into a subfolder. I achieved this using the find command like so:
I wish I’d discovered this about three years ago when I first started learning the bash command line – it would have saved a lot of remembering paths and typing them.
As mentioned in my post from yesterday, adding virtual hosts to OpenBD is slightly awkward in that it not only requires adding them in the Apache config but also in the Tomcat’s server.xml file.
The following shell script works for a standard Centos installation where the webserver used is Apache with the following default paths used:
Apache vhosts file -> /etc/httpd/conf/vhosts
Tomcat server.xml file -> /opt/openbd/tomcat/conf/server.xml
Assuming all virtual hosts live inside the same parent directory then this directory can be set in the script’s configuration on line 5. Once set, adding a new virtual host is as simple as saving it as something meaningful (in this case ‘addvh.sh’) and calling it with the full domain name of the virtual host passed as a parameter like so:
# ./addvh.sh my.domain.com
One important point: this script relies on Apache’s usage of a separate vhosts file in the /etc/httpd/conf directory. This file can be pulled in and read by the main httpd.conf file by adding the following line to it.
What the script does?
1. creates a new document root folder for the virtual host and places an index.cfm test page inside it.
2. adds the virtual host entry to the httpd.conf file
3. adds the virtual host entry to the server.xml file
4. restarts Apache
5. restarts OpenBD
Once the script has run then if all goes well you should be able to browse to your new virtual host and check the CFML parsing by typing http://<new virtual host domain>/index.cfm
Here’s the script:
# Configure the script
firstname.lastname@example.org' # email address of administrator
vhroot='/www' # no trailing slash
# Create the new document root folder
if [ "$1" = "" ]
echo "No arguments passed. Usage: addvh <vhostName> where <vhostName> is the full domain"
echo "(or subdomain) of the virtual host. E.g test.com, mypoject.test.com"
# Try to create the new document root
elif ! mkdir $vhroot/$1
echo "ERROR: "$vhroot"/"$1" could not be created."
echo "Virtual host document root created in "$vhroot"/"$1
# Add the virtual host to the vhosts file
if ! echo "
</VirtualHost>" >> /etc/httpd/conf/vhosts
echo "ERROR: the virtual host could not be added to the Apache vhosts file"
echo "New virtual host added to the Apache vhosts file"
# Update the Tomcat server.xml file with the new virtual host
rs=' <Host name="'$1'" appBase="webapps"\
<Context path="" docBase="'$vhroot'/'$1'/" />\
sed 's|</Engine>|'"$rs"'|' </opt/openbd/tomcat/conf/server.xml >tmp
mv /opt/openbd/tomcat/conf/server.xml /opt/openbd/tomcat/conf/server.xml.BAK
mv tmp /opt/openbd/tomcat/conf/server.xml
echo 'New virtual host added to the Tomcat server.xml file'
# restart Apache
service httpd restart
# restart Tomcat/OpenBD
# create a demo script for testing the CFML works in the new vhost
echo '<cfdump var="#CGI#">' > $vhroot/$1/index.cfm
# show the finished message
echo "Complete! The new virtual host has been created.
To check the CFML functionality browse http://"$1"/index.cfm
Document root is "$vhroot"/"$1