diff --git a/script/file_manage.sh b/script/file_manage.sh index d43320e..e00382b 100644 --- a/script/file_manage.sh +++ b/script/file_manage.sh @@ -86,4 +86,19 @@ fi } -export -f file_purge dir_check file_check numeric_check +# input: email, job name, status +email_note(){ +email=$1 +job_name=$2 +status=$3 + +if [[ $email != "*@*" ]] +then + if [[ $(which mail) != "" ]] + then + echo -e "Your $job_name using SIGNET is $status \n" | mail -s "SIGNET NOTIFICATION" $email + fi +fi +} + +export -f file_purge dir_check file_check numeric_check email_note diff --git a/script/network/bts1gensub.sh b/script/network/bts1gensub.sh index d8ddf0d..4b6512c 100755 --- a/script/network/bts1gensub.sh +++ b/script/network/bts1gensub.sh @@ -104,8 +104,10 @@ nresult=$(find ypre* | wc -l ) if [ $nresult -eq $NJOBS ] then echo -e "All the jobs are finished !!\n" +email_note $email "Stage 1" "Completed !!!" else echo -e "Please notice that some of the jobs are unfinished. Program will stop and please try to find the problem. \n" +email_note $email "Stage 1" "Stopped ..." grep -Eo '[0-9]+$' submit1_log | xargs scancel kill -10 $job_id exit -1 diff --git a/script/network/bts2gensub.sh b/script/network/bts2gensub.sh index 7af519e..018718b 100755 --- a/script/network/bts2gensub.sh +++ b/script/network/bts2gensub.sh @@ -108,8 +108,10 @@ nresult=$(find Adj* | wc -l ) if [ $nresult -eq $NJOBS ] then echo -e "All the jobs are finished !!\n" +email_note $email "Stage 2" "Completed !!!" else echo -e "Please notice that some of the jobs are unfinished. Program will stop and please try to find the problem. \n" +email_note $email "Stage 2" "Stopped ..." grep -Eo '[0-9]+$' submit2_log | xargs scancel kill -10 $job_id exit -1