Scripting

Watermark pictures using exiv2

Quick and dirty batch script to watermark and add IPTC data to a set of files in the supplied dir to -Copyright. #!/bin/bash # Copyright Andy Wright – www.litost.org 2006. # You have permission to do what you want with it as long as you don’t # blame me if it insults your mother etc. […]

Read More
Linux

Start/Stop script for a prosess run as another user

#!/bin/sh # rc.flexlm – Init.d start/stop script for the FlexLM License Manager # Variables: LM_DIR=”/usr/local/matlab71/etc” LM_BIN=”lmgrd” PROG_BIN=”$LM_DIR/glnx86/$LM_BIN” LICENSE_FILE=”$LM_DIR/license.dat” RUN_AS=flexlm LOG_FILE=”/var/log/flexlm.log” PROG_ARGS=”-c $LICENSE_FILE -l $LOG_FILE” # Sleep time for restart. SLEEP=1 start() { echo -n “Starting FlexLM License Manager ($LM_BIN): ” # already running? PID=$(pidof -s $PROG_BIN) if [ -z $PID ]; then # Initialize log […]

Read More
Linux

A-Z index of the linux Bash

alias Create an alias awk Find and Replace text within file(s) break Exit from a loop builtin Run a shell builtin cal Display a calendar case Conditionally perform a command cat Display the contents of a file cd Change Directory chgrp Change group ownership chmod Change access permissions chown Change file owner and group chroot […]

Read More
Linux

List processes in a hierarchy

ps -e -o pid,args –forest List processes by % cpu usage ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’ List processes by mem usage ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS List info for particular process IDs ps -p 1,2

Read More