Create file in $PBS_O_WORKDIR

I want to create file in $PBS_O_WORKDIR few minutes before specified walltime exceeds.

anyone have idea about above query please let me know.

Thank you in advance.

  1. server periodic hook or cronjob

    • threshold time to create file is 95% of walltime is used
    • find out remaining walltime ( used_walltime , requested_walltime , available_walltime)
    • write a file when the threshold is about to reached.
  2. implement some kind of timer within the script, when it is about to hit the 98% threshold of your requested walltime , then write a file.

@adarsh Thank you for possible solutions,

  1. If i go with hooks, how we can implent this hooks for specific jobs instead of all jobs on cluster.

Specific jobs needs to be tagged for this , requesting

  • for example specific user or list of users
    – for example specific software or list of softwares
    – for example specific queue or queue(s)

And can I fetch job_ib in submission script after qsub command, As right now I’m trying to echo $PBS_JOBID but it is showing my remote session jobid through which I’m submitting my job.

A hook is the best way but for a quick and dirty way you could implement it using bash within the submission script:

  1. At the start of the PBS sub script get the system time, add 95% of walltime to get the time at which to create the directory. This can be done using bash arithmetic.
  2. Set a user cron job to create the directory at that time.
  3. The rest of the submission script is your normal commands.

A hack but it would probably work with little effort.
Might be helpful: shell - How to create a cron job using Bash automatically without the interactive editor? - Stack Overflow

@speleolinux @adarsh Actually i created script and merged this script with job submission script but now i stuck on 1 things,

  1. How we can get start time of queued job right after job submission, as using qstat -f we can’t get start time until job gets start execution.