Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Friday, October 7, 2011

Tomcat: check if process is running

Put this in a cronjob and check every 5 min:

#!/bin/sh

if [ `ps x | grep "java.*" | grep -v grep | grep -vi screen | wc -l` = "0" ]
then
cd /root/my_app
./start > /dev/null &
fi

Wednesday, September 15, 2010

Sym Link to multiple CIFS mounts

A simple script that creates sym links to multiple cifs mounts and dumps them into a master folder.


#!/bin/bash

DIR="/media/MDrive/"
DIR2="/media/ZDrive/"
DIR3="$DIR $DIR2"
DIR4="masterDownloads"
#echo $DIR3

IFS=$'\n'

#for i in $(find $DIR -type f -printf "%f\n")
for i in $(find $DIR -type f)
do
echo "Processing... $i"
mkdir -p ./$DIR4/$(dirname $i)
ln -s $i ./$DIR4$i
clear
done

Thursday, July 22, 2010

Quick Image resize


for a in $(find . -iname \*.jpg); do convert $a -resize 640x480 small/$a; done