This file is indexed.

/usr/share/arc/scan-gridfactory-job is in nordugrid-arc-arex 1.1.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/sh
#
# Periodical scan job directory for jobs that has finished
# 
# usage: scan_gridfactory_job control_dir ...

joboption_lrms=gridfactory

# ARC1 passes first the config file.
if [ "$1" = "--config" ]; then shift; ARC_CONFIG=$1; shift; fi

basedir=`dirname $0`
basedir=`cd $basedir > /dev/null && pwd` || exit $?

pkgdatadir="$basedir"

. "${pkgdatadir}/configure-${joboption_lrms}-env.sh" || exit $?

options=$@

TMPDIR=${TMPDIR:-/tmp}
#debug='eval echo >> $TMPDIR/parse-gridfactory-log.$id'
debug=:

$debug "run at `date`"
$debug "options = $options"

# first control_dir is used for storing own files
control_dir=$1
control_dirs=
while [ $# -gt 0 ] ; do
  control_dirs="${control_dirs} \"$1\""
  shift
done

for control_dir in "$options" ; do
    # Checking id directory exists
    if [ ! -d "${control_dir}" ]; then 
	echo "No control dir $control_dir" >&2
	$debug "No control dir $control_dir"
        continue
    fi
    # Select jobs in LRMS state
    for job in `grep -H INLRMS ${control_dir}/processing/job.*.status 2>/dev/null | sed -e 's/.*job.//' -e 's/.status.*$//'` ; do
        $debug "scanning job = $job"
        unset joboption_jobid
	unset joboption_user
        unset joboption_directory
	
	# check for lrms.done file
        [ -f "${control_dir}/job.${job}.lrms_done" ] && continue
	
	# check for grami file
        [ ! -f "${control_dir}/job.${job}.grami" ] && continue
        .  "${control_dir}/job.${job}.grami"
	
	# check for jobid in grami file
        [ -z "$joboption_jobid" ] && continue
	
        $debug "local jobid = $joboption_jobid"
        $debug "local user  = $joboption_user"

	# Check job status with pstat
	GF_TRIES=0
	while [  $GF_TRIES -lt 5 ]; do
	    [ $GF_TRIES -eq 4 ] && echo "pstat failed" > "${control_dir}/job.${job}.lrms_done"
	    status_code=`su -c "$PSTAT $joboption_jobid" - $joboption_user | sed "s!.*$joboption_jobid !!"`
	    if [ $? -eq "0" ];then
		break
	    else
		echo "pstat failed" 1>&2
		GF_TRIES=$(($GF_TRIES + 1))
		sleep 10
	    fi
	done
   	$debug "pstat returned $status_code"
        case $status_code in
	    
            "failed")
		echo "Job lost in LRMS" > "${control_dir}/job.${job}.lrms_done"
		;;

            "done")
		exitcode=0
		for file in $joboption_rsl_outputfiles; do
		#skipping GM output files
		    [ $file = "$joboption_rsl_gmlog" ] && continue
		    [ $file = "$joboption_rsl_stdout" ] && continue
		    [ $file = "$joboption_rsl_stderr" ] && continue
		# getting output files
		    cp -p `echo $joboption_jobid|sed 's,file://,,g'`/$file $joboption_directory/$file
		    [ $? -ne "0" ] && echo "transfer of outputfile $file failed" 1>&2
		done
	        # Erasing of GridFactory stdout
		spool_dir=`echo $joboption_jobid|sed 's,file://,,g'`
		file=$spool_dir/stdout
		head -n -2 $file > $file.tmp
	        # Getting exitcode
		exitcode=`tail -1 $file.tmp|sed 's/exitcode //'`
		$debug "exitcode $exitcode"
		head -n -1 $file.tmp > $file
		rm -f $file.tmp
	        # copying stdout and stderr
		cp -p $file $joboption_directory/$joboption_rsl_stdout
		cp -p $spool_dir/stderr $joboption_directory/$joboption_rsl_stderr
	        su -c "$PCLEAN $joboption_jobid" - $joboption_user
		echo "$exitcode Executable finished with exit code $exitcode" > "${control_dir}/job.${job}.lrms_done"
		;;

           "aborted")
		echo "Job kill by user" > "${control_dir}/job.${job}.lrms_done"
		;;
	    
            "NOT found")
		sleep 60
		status_code=`su -c "$PSTAT $joboption_jobid" - $joboption_user | sed 's,$joboption_jobid ,,'`
		if [ $status_code = "NOT found" ]; then
		    echo "Job lost in LRMS" > "${control_dir}/job.${job}.lrms_done"
		fi
		;;
        esac
    done
done

$debug "done, going to sleep"
sleep 30
exit 0