Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import threading
- import logging
- import os
- import time
- logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-5s) %(message)s')
- threads = {}
- mountpoints = ["mp_" + str(x) for x in range(30)]
- def worker(mountpoint: str):
- path = os.path.join(mountpoint, "f_" + mountpoint)
- logging.debug("writing to {}".format(path))
- with open(path, "w") as f:
- for x in range(10):
- time.sleep(0.05) # 50 miliseconds
- f.write(str(time.time()) + '\n')
- for d in mountpoints:
- os.mkdir(d)
- subprocess.check_call("mount -t cifs -o username=user,domain=domain.local,password=password //server/share$ {}".format(d), shell=True)
- t = threading.Thread(name=d, target=worker, kwargs={"mountpoint":d})
- t.daemon = True
- t.start()
- threads[d] = t
- for d,t in threads.items():
- t.join()
- subprocess.check_call("umount {}".format(d), shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement