converting webm to mp3s ffmpeg

for FILE in *.webm; do echo -e “Processing file ‘\e[32m$FILE\e[0m'”; ffmpeg -i “${FILE}” -vn -ab 128k -ar 44100 -y “${FILE%.webm}.mp3”; done; nJoy 😉

Snapshot backup using cp -al and rsync

This script requires genuine cp -al capable gnu and rsync commands together with a hardlink capable FS + OS.     #!/bin/bash [ $# -ne 2 ] && echo “Incorrect usage : $0 <source path> <target path>” && exit 128 ; SOURCEFOLDER=$1 TARGETFOLDER=$2 SF_LEN=${#SOURCEFOLDER}-1 TF_LEN=${#TARGETFOLDER}-1 #echo “Last character in source folder is ${SOURCEFOLDER:SF_LEN}” if […

Run a local script on remote machine with parameters

So you have a script on the local machine and you want to run it remotely and pass arguments to it : ssh user@remote ‘cat | bash /dev/stdin param1 param2 .. paramN’ < /usr/scripts/localscript.sh 😉 nJoy  

Recording a session for a user when he / she logs in ssh

  To start recording each session add this to the users .profile file DATE=$(date +”%Y%m%d%H%M”) mkdir /log/$DATE script -t 2>/log/$DATE/bashlogs.timing -aqf /log/$DATE/bashlogs.script   to playback go to /log/<timestamp> and run scriptreplay  bashlogs.timing bashlogs.script 3 where the 3 is the speed up factor. nJoy;  

Quick script to get path to latest nagios version

If you need to automate the retrieval of the latest Nagios version path to download this is how I do it. Nothing fancy and it breaks if they change the sourceforge site but we can fix when that happens 🙂   curl -v http://www.nagios.org/download/core/thanks/ 2>&1 | grep tar\.gz | cut -d \” -f 2 |…