## Posts List

This is just a simple script for doing a diff of two web pages. #!/bin/bash TMP1=$(mktemp) TMP2=$(mktemp) wget -q $1 -O$TMP1 wget -q $2 -O$TMP2 diff $TMP1$TMP2 rm -f $TMP1$TMP2

This is just a quick note to save this useful bit of information. I may make in to a script one day or use it in something else. echo ''|openssl s_client -connect localhost:636 2>/dev/null | openssl x509 -noout -enddate | sed 's/^not.*\=//'

This is just a quick note to save this useful bit of information. I may make in to a script one day or use it in something else. echo ''|openssl s_client -connect localhost:636 2>/dev/null | openssl x509 -noout -enddate | sed 's/^not.*\=//'

Small script to run a instance of mysql in my home directory using the binary provided by the OS. Maybe some day I will make it more usable but for the time being it suits my needs. #!/bin/bash MYSQL_HOME=$HOME MYSQL_USER=$USER MYSQL_PORT=13306 ACTION=$1 if [$ACTION == 'init' ]; then echo "initalising new mysql installation at $MYSQL_HOME/var/lib/mysql" rm -rf$MYSQL_HOME/var/lib/mysql mkdir -p $MYSQL_HOME/var/lib/mysql$MYSQL_HOME/mysql/data $HOME/var/lib/mysql/tmp mysql_install_db --user=$MYSQL_USER --datadir=$MYSQL_HOME/var/lib/mysql/data/ cat <$HOME/.my.cnf [mysqld] user=$MYSQL_USER datadir=$MYSQL_HOME/var/lib/mysql/data log-error=mysqld.

Have you ever needed to run a bunch of long running processes from a bash script and get their return codes ? I come across this issue quite frequently in my line of work. The most common one is where i need to run rsync to collect files from many machines then if successful run some other task. Depending on the amount of servers and data this can take several hours to run sequentially and I don’t really like waiting around to check the output so that I can run the next task.

I quite often need to remove a single line from a file by its line number. The most common use case for me is the known_hosts file when I have reinstalled a system, I have in the past used vim and navigated to the line then removed it. This is all well and good but it gets to be a pain having to do it repeatedly, especially when you manage around 1000 servers and the get rebuilt frequently.

This post is here mainly because I always forget how to do it. This is one of the simplest ways to reinstall a Centos (will probably work for RHEL and maybe even Fedora) system without needing PXE or physical access to the machine. Make sure that that you have tested you kickstart before you use it and don’t blame me if anything goes wrong. Save the following script and make it executable then run it.