3

Say if I need to run a command checkstatus --jobnumber 12345 to check the job status. The command prints out the info to standard output. Is there any way to run this command on shell repeatedly every minute? I wanted to see the latest job status.

2
  • 1
    why you dont wan't to use crontab?
    – Alan Kuras
    Mar 7, 2012 at 6:02
  • I think the idea is to run it in the foreground. crontab would run the command in the background, and even if it could run it in the foreground it'd be overkill, IMHO. This is exactly what watch is for.
    – Will
    Apr 29, 2016 at 20:26

2 Answers 2

10

Also watch(1)

1
  • 2
    this is the best way imho. watch -n 60 'command to run'
    – Sirex
    Mar 7, 2012 at 7:46
1

Here's a small bashscript that would do that:

#!/bin/bash 

while : 
do
        checkstatus --jobnumber 12345;
        sleep 60;
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.