On Thu, 2018-07-26 at 14:01 +1000, Derrick Lin wrote: > Hi all, > > I am working on a prolog script which setup xfs quota on disk space > per job basis. > > For setting up xfs quota in sub directory, I need to provide project > ID. > > Here is how I did for generating project ID: > > XFS_PROJID_CF="/tmp/xfs_projid_counter" > > echo $JOB_ID >> $XFS_PROJID_CF > xfs_projid=$(wc -l < $XFS_PROJID_CF) > > My test shows, when there are multiple jobs start on the same exec > host at the same time, the prolog script is executed almost the same > time, results multiple jobs share the same xfs_projid, which is no > good. > > I am wondering if I can configure the scheduler to start the jobs in > a sequential way (probably has a interval in between).
Hi Derrick, Assuming you're using Bash (based on your snippets above), it's probably better to use flock to lock/unlock your project id counter file and ensure exclusive access. There's some basic examples in the man page, and a Gist with very useful functions here: https://gist.github.com/przemoc/571091 Cheers, Chris _______________________________________________ users mailing list users@gridengine.org https://gridengine.org/mailman/listinfo/users