0

Let's assume that I am running a shell script that takes hours/days to run. How do I make sure that after that script finishes another script will start, without re-running everything from scratch?

2 Answers2

1

You could create one main script with two lines: 1st line SCRIPT A and 2nd line SCRIPT B. The script B won't start until script A is finished.

J_P
  • 761
  • 8
  • 17
  • The thing is that I am assuming that the first script is already running. Of course I could stop it, write the main script and run the whole thing again. The thing is that I don't want to waste the time spent running the first script up to that point. – Tchaikovic Feb 05 '18 at 15:49
  • if the script is already running... it's a totally different scenario, probably you need a script to read from the task manager..., something lile this # PowerShell Get-Process list Get-Process * and then deal with the output – J_P Feb 05 '18 at 15:54
0

Typically this is solved in a few ways, depending on your situation:

  • Create a "driver" shell script that runs both scripts, one after the other
  • Have the first script run the second script as its final step
  • If you're running the scripts from cron, use the && operator to run the scripts one after the other
Mr. Llama
  • 20,202
  • 2
  • 62
  • 115