#!/bin/bash

# Number of jobs
JOBS=3

# Maximal running jobs
MAXJOBS=999

# Define colors
COLOR_NORMAL="\033[0m"
COLOR_GREEN="\033[32m"
COLOR_RED="\033[31m"

# Mailn program
clear
echo -e "JOB\tSTATUS"
for ((i=1 ; i<=$JOBS ; i++))
do
		# Creating same lenght string numbers
		nummax=`echo $MAXJOBS | wc -c`
		numcounter=`echo $i | wc -c`
		numzero=`expr $nummax - $numcounter`
		JOB=""
		for ((j=0 ; j<$numzero ; j++))
		do
			JOB=`echo $JOB"0"`
		done
		JOB=`echo $JOB$i`

        	echo -ne "$JOB"
		# Print job status
	        glite-wms-job-status -i job_$JOB/jobIDfile | awk '/Current Status:/ { printf "\r\t%s",$3 }'
		echo
done

