Hi,
I have a task that Im stuck on. I have an elementary script named 'myscript' that prints "the script is running" once a second. It runs for 27 seconds. I need to write a 2nd script that starts 'myscript' and takes a parameter '$1' for a number. my 2nd script then needs to pause myscript every $1 seconds for $1 seconds until myscript completes. myscript should not be 'aware' or 'listen' for anything.
I tried the wait command but it starts over instead of picking up where it left off. I looked at setting myscript as a background process, but again that doesnt seem like the solution as it wouldn't pause.
Please can someone explain what commands/approach they would use to solve my problem?
My only other thought would be to grep the process from ps as a looping condition, if it exists then put it to sleep (I dont think I can use the sleep command in this way though..?).
Thank you in advance for any help you can offer my noob self.
Best regards,
Dane Ensign