Cc L Cc L - 1 year ago 110
Python Question

Shell Script: execute & repeat a python program that needs extra input

I have to run this python command:

python rebuild_index
at a certain time and rerun again. Therefore, I am trying the shell script to run it. However, when run this python command, I have to choose
to continue.

enter image description here


python rebuild_index

Moreover, how can I let the
rerun again after every 60 seconds?

Answer Source

You can use yes for this:

yes | python / rebuild_index

One way to run your script every minute:

while yes | python / rebuild_index; do
  sleep 60

The above will run your script every 60 second until it fails.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download