Category: bash


Server load alert

#!/bin/bash

loadavg=$( cut -d’ ‘ -f2 /proc/loadavg | cut -d. -f1 )
alarmme=”youremail@yourdomain.com”

if [ $loadavg -gt "5" ] ; then
echo “Hi the server load for the past 5 minutes is $loadavg” | mail -s “Alarm from $HOSTNAME” $alarmme ;

fi

youtube.sh

#!/bin/bash

BASEURL=”http://youtube.com/get_video.php?” ; read -p “YouTube URL? ” ORIGURL ; read -p “Desired path/filename? ” OUTFILE

wget -c -S -O ${OUTFILE}.flv ${BASEURL}`curl -s ${ORIGURL} | grep player2.swf | cut -f2 -d? | cut -f1 -d\”` && ffmpeg -i ${OUTFILE}.flv -ab 56 -ar 22050 -b 500 -s 320×240 ${OUTFILE}.mpg && exit 0

Follow

Get every new post delivered to your Inbox.