Cluster not working Not command found

Hello, this afternoon I've been having troubles with the cluster because sometimes the commands work and sometimes they don't. Like for example "basename", or any other command in a module, even when I've loaded it before, it says "command not found". Is there something wrong going on in the cluster?? I remember I had this problem in the past rigth before the cluster had to undergo maintenance.
Thanks in advance

Hello @jramirez ,

No maintenance planned. Everything is fine on the cluster from our point of view.
If a "command not found" error happens, it's often due to an error on the PATH or other environment variable.
Can you reproduce the error ? Could you provide us all the sequence of commands ?

Hello, thenks so much for the reply, today it's working for some reason. An exmaple of what was happening is that in a job I was using basename to go over the files of a folder, and I kept getting the same "command not found: basename". Then my way of testing what was going on was to run the part of the job that contained the "basename" using echo, like this:
for fastq in ./*_R1_001.fastq.gz
do
ID=basename -s _R1_001.fastq.gz $fastq
echo ${ID}
done

And with this, if I used it several times (the exact same lines), some times it worked , but sometimes it displayed the "command not found: basename"

Hello,

Sorry for the response time.
I guess something goes wrong with the PATH environment variable (maybe you or a script have change it when it goes wrong). I don't see another explanation. It should work.

If you can reproduce it, you could give us all the commands used before and after.

Note: not part of the problem, but I would recommend to use ${} notation and to always backquote variables (as describe for example here: Bash scripting best practices - sap1ens blog). Moreover, I would also recommand to use $(cmd) for command substitution (as opposed to backquotes).
So I would write:

fastq in $(ls ./*_R1_001.fastq.gz)
do
  ID=$(basename -s _R1_001.fastq.gz "${fastq}")
  echo "${ID}"
done
1 « J'aime »