I am using shell script to run youtube-dl to download multiple videos in the same time, and it runs perfectly. But sometimes the download speed is too slow, I want to kill the process and restart it(It always runs faster the second time, and Without killing the process, the downloaded video would always be corrupted). The thing is, i couldn't find a way to kill it.
I tired to insert osascript in Shell Script to get its process ID:
osascript -e 'tell application "Keyboard Maestro Engine" to setvariable "PID" to "'$$'"'
But it seems youtube-dl called some python program with its own process ID, so using the PID of the shell script doesn't really work.
So my questions is:
Is it possible to get the real process ID of youtube-dl and return it?
if not, does killing the macro(it runs asynchronously) work?
Or is there any other way to kill the process?
Thank you very much!