Skip to content
Advertisement

Run multiple terminals from python script and execute commands (Ubuntu)

What I have is a text file containing all items that need to be deleted from an online app. Every item that needs to be deleted has to be sent 1 at a time. To make deletion process faster, I divide the items in text file in multiple text files and run the script in multiple terminals (~130 for deletion time to be under 30 minutes for ~7000 items).

This is the code of the deletion script:

JavaScript

So, I divide the items in deletion_pair.txt and run this script multiple times in new terminals (~130 terminals). Is there a way to automate this process or do in more efficient manner?

Advertisement

Answer

I used threading to run multiple functions simultaneously:

JavaScript

It worked! Any one has any other solution, please post or if the same code can be written more efficiently then please do tell. Thanks.

Advertisement