`watch` command with piping `|` [duplicate]
`watch` command with piping `|` [duplicate]
This question already has an answer here:
I want to keep monitoring a specific job on a slurm worload like cluster. I tried to use the watch command and grep the specific id. If the job id is4138, I tried
watch
grep
id
4138
$> watch squeue -u mnyber004 | grep 4138
$> squeue -u mnyber004 | watch grep 4138
but they doesn't work. The second command works for the first few seconds, but stop working when watch refreshes.
watch
A better idea please?
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2 Answers
2
You have to quote the command
watch 'squeue -u mnyber004 | grep 4138'
The other answer covers how to handle using the 'watch' utility with a pipe but since you're using Slurm and know the job ID, just ask Slurm for that job's status:
$> watch squeue -j 4138
It works well too. thanks
– many
Aug 27 at 22:09