Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- ##cat a file for a job writing in node /local
- script=`basename $0`
- if [ $# -ne 2 ]; then
- echo " "
- echo "Usage: $script job_id file"
- echo " "
- else
- job_id=$1
- file=$2
- ##verify that job_id is actually running
- checkjob=`qstat | grep -ci " $job_id "`
- if [ $checkjob == 0 ]; then
- printf "!!!!!!! job $job_id is not running!! \n"
- exit 1
- fi
- ## get running node for job_id
- node=`qstat | grep $job_id | sed -n 's/[^@]*@//p' | sed 's/\..*//'`
- printf "\n!!!!!!! job is running in \"$node\" node!!\n"
- work_dir=/local/$USER
- printf "!!!!!!! start cat at node for file $work_dir/$job_id/$file \n\n"
- ### check if file exist in corresponding location; if not exit
- nofile=`rocks run host $node "test -e $work_dir/$job_id/$file && echo 'false' || echo 'true'"`
- if $nofile ; then printf "\n file $work_dir/$job_id/$file does not exist in node!!! \n\n" ; exit 1 ; fi
- ##cat the file!
- rocks run host $node "cat $work_dir/$job_id/$file"
- printf "\n!!!!!!! cat ended\n"
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement