Created
March 15, 2020 11:47
-
-
Save cocoa1231/40b2036be39010bfa1a8170116596a65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
users = [filename for filename in os.listdir('/var/cpanel/users') if os.path.isfile(filename)] | |
batches = ['server8.flaunt7.com', 'server9.flaunt7.com', 'server10.flaunt7.com'] | |
def chunks(lst, n): | |
for i in range(0, len(lst), n): | |
yield lst[i:i+n] | |
chunked_users = chunks(users, len(batches)) | |
for i, userlist in enumurate(chunked_users): | |
with open(batches[i], 'w') as f: | |
f.write('\n'.join(userlist)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment