Helo, i have written a bash script for running my calculations. anyway, according to shellcheck the error is somewhere in the while loop or in the if condition.
so the idea of this script is:
submit a job with a name.
while it is in the queue it has a job ID number.
after the job is done i want to proceed with further ORDERS, for this i need a while loop and a if condition
the script:
with this order:
i receive the job id in numbers when i type in the shell. yet i dont know if these numbers are stored as a string or integers.
with regards
---------- Post updated at 08:41 AM ---------- Previous update was at 07:40 AM ----------
so now i've changed the while loop and it works almost:
what does not work, are the FOLOWING_ORDERDS. Does "break" in the while loop terminate the wole bashscrpit?
so the idea of this script is:
submit a job with a name.
while it is in the queue it has a job ID number.
after the job is done i want to proceed with further ORDERS, for this i need a while loop and a if condition
the script:
Code:
#!/bin/bash -l
#Name of the job gets defined
my_job_name='NEB3'
#Name of the folder is defined.
calcname='3rd_NEB-NH-off_to_BHNH-ortho'
[
#creating job directories etc.
]
cd /job_path/NEB_jobs/jobf_${my_job_name}
sbatch job_${my_job_name}
#Id of the job in the queue is registered
my_id=squeue -u myname | sed -n "/${my_job_name}/ {s/[\ ].*//; p}"
while sleep 30; do
if [ "${my_id}" != squeue -u myname | sed -n "/${my_job_name}/ {s/[\ ].*//; p}" ]; then
break
done
#cp folders
#further ORDERS
with this order:
Code:
squeue -u myname | sed -n "/${my_job_name}/ {s/[\ ].*//; p}"
with regards
---------- Post updated at 08:41 AM ---------- Previous update was at 07:40 AM ----------
so now i've changed the while loop and it works almost:
Code:
#!/bin/bash -l
#Name of the job gets defined
my_job_name='NEB3'
#Name of the folder is defined.
calcname='3rd_NEB-NH-off_to_BHNH-ortho'
[
#creating job directories etc.
]
cd /job_path/NEB_jobs/jobf_${my_job_name}
sbatch job_${my_job_name}
#Id of the job in the queue is registered
my_id=squeue -u myname | sed -n "/${my_job_name}/ {s/[\ ].*//; p}"
while sleep 30; do
temp_id=&(squeue -u myname | sed -n "/${my_job_name}/ {s/[\ ].*//; p}")
if [ "${my_id}" != "${temp_id}" ]; then
break
fi
done
FOLLOWING_ORDERS
what does not work, are the FOLOWING_ORDERDS. Does "break" in the while loop terminate the wole bashscrpit?