Cron Job

Eingetragen als cron-Job auf cmip2 (aktuell auf vre1) mit 'crontab -e', login als k204081,

# Minute Stunde Tag(Monat) Monat Tag(Woche) Kommando # (0-59) (0-23) (1-31) (1-12) (1-7); 1=Mo) 0 10 * * 1,3,5,6 source /pf/k/k204081/.bashrc;/usr/local/globus/bin/myproxy-logon -T -t 72 -l HansRamthun -S</pf/k/k204081/.myproxy; #30 * * * * #echo "WGET" > ~/.lock;wget -O /gpfs_750/projects/ISI_MIP/test.zip -o speed.lst http://vre1.dkrz.de:8080/thredds/fileServer/isi_mipEnhanced/HadGEM2-ES/historical/huss_v1/huss_bced_1960_1999_hadgem2-es_historical_2001-2005.zip; tail -2 speed.lst | grep ' ' >> /gpfs_750/projects/ISI_MIP/isimip_transfer_speed.lst;rm speed.lst /gpfs_750/projects/ISI_MIP/test.zip;rm ~/.lock

* 0 * * 1 /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -a

* 2 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -x

* 4 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 1

* 6 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 2

* 8 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 3

* 10 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 4

* 12 * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 5

* 14 * * 1 /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 6

50 * * * * /gpfs_750/projects/ISI_MIP/monitor.sh -p ISI_MIP -f 7

Aktuelles Monitoring Scrip

liegt unter: /gpfs_750/projects/ISI_MIP/monitor.sh

#!/bin/bash

# first be sure it's bash... anything out of bash or sh will break # and the test will assure we are not using sh instead of bash if [ $BASH ] && [ basename $BASH != bash ]; then

fi

# project directory

# today actdate=date "+%Y_%m_%d"

check_os() {

}

usage() {

} #defaults debug=0 clean_work=1

PROJ=ISI_MIP BASE_DIR="/gpfs_750/projects/"

#parse flags while getopts ':p:c:f:xaw:dhvq' OPT; do

# 0 count all # 1 file count # 2 dir count # 3 count total size of data directory # 4 count not empty directories # 5 count files one day ago # 6 count files one week ago # 7 test of download speed vre1.dkrz.de # 8 download speed test (not yet implemented) # 9 download speed test (not yet implemented)

done shift $(($OPTIND - 1))

PROJ_DIR=$BASE_DIR$PROJ DATA_DIR=$PROJ_DIR"/data/"

DIR_LIST_OUT=$PROJ_DIR"/"$PROJ"_"$actdate"_dir.lst" SPEED_LIST=$PROJ_DIR"/"$PROJ"_transfer_speed.lst" FILE_LIST_OUT_DAILY=$PROJ_DIR"/"$PROJ"_"$actdate"_files_one_day.lst" FILE_LIST_OUT_WEEK=$PROJ_DIR"/"$PROJ"_"$actdate"_files_one_week.lst" CONTENT_LIST=$PROJ_DIR"/"$PROJ"_"$actdate"_content_weekly.lst" STAT_RESULT=$PROJ_DIR"/"$PROJ"_statistics.lst"

CATALINA_HOME=$PROJ_DIR"/apache-tomcat/"

TEST_URL=http://vre1.dkrz.de:8080/thredds/fileServer/isi_mipEnhanced/HadGEM2-ES/historical/huss_v1/huss_bced_1960_1999_hadgem2-es_historical_2001-2005.zip LOCK_FILE=~/.lock

# check if output path exists if ! -e $PROJ_DIR; then

fi

# if not set set output file if ! "$output"; then

fi

((verbose)) && echo "Project is: "$PROJ ((verbose)) && echo "Base directory is: "$BASE_DIR ((verbose)) && echo "Project directory is: "$PROJ_DIR ((verbose)) && echo "Project data directory is: "$DATA_DIR ((verbose)) && echo "Output of test are written to: "$output ((verbose)) && echo "Output of directory hierachy is written to: "$DIR_LIST_OUT

check_process() {

}

#echo $output | awk -F"/" '{print "/"}' #echo ${output%/*}

# first check if something is going on check_process

if "$output"; then

# if -f "$output"; then # read -p "Overwrite existing file $output? (y/N) " answ # case $answ in y|Y|yes|Yes|YES);; *) echo "Aborting then..."; exit 0;; esac # fi

fi

((debug)) && echo "Tomcat home is: "$CATALINA_HOME ((debug)) && echo "COUNT:"$count

if "$count"; then

fi

if $content; then

fi

if $statistics; then

fi

exit 0

DT=date '+%F';ls -alR /gpfs_750/projects/ISI_MIP/data >/gpfs_750/projects/ISI_MIP/C/content_$DT.lst

# count total number of directories D2=find $DATA_DIR -type f | wc -l;D3=find $DATA_DIR -type d | wc -l

# count and add to file D4=du -sh $DATA_DIR

# output all to output file echo $actdate" (dir count): "$D3", (file_count): "$D2" (total size): "$D4 >> $OUT_FILE

# count number of not empty directories which contain at least one file and add to a daily listfile find $DATA_DIR -mindepth 1 -maxdepth 1 -not -empty -type d > $DIR_LIST_OUT

# test transfer speed # --http-user and --http-password must be from ~/wgetrc available wget -O $PROJ_DIR/test.zip -o speed.lst $TEST_URL

# add to transfer speed list tail -2 speed.lst | grep ' ' >> $PROJ_DIR"/"$PROJ"_transfer_speed.lst" rm speed.lst $PROJ_DIR"/test.zip"

for i in 01 02 03 04 05 06 07 08 09 10 11 12; do

# actdate="2012-"$i"-"$k

# echo $i $k $file

# actdate=date --date "$actdate -1 days ago" "+%F" # if "$actdate > $enddate"; then # echo "DONE! "$actdate" "$enddate # break # fi done

MadWiki: ISIMIP Monitoring (last edited 2013-11-27 13:33:11 by HansRamthun)