D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
2
/
task
/
2
/
root
/
opt
/
imh-python
/
lib
/
python2.7
/
site-packages
/
cmu_ded
/
scripts
/
Filename :
reset.py
back
Copy
#!/opt/imh-python/bin/python """ Reseting the VPS you are one by removing all the users. """ import os import subprocess from rads.shared import is_cpanel_user if __name__ == '__main__': users = os.listdir('/var/cpanel/users/') for single_user in users: print single_user if 'system' not in single_user and is_cpanel_user(single_user): yes_exec = subprocess.Popen(['/bin/yes'], stdout=subprocess.PIPE) removeacct_exec = subprocess.Popen(['/scripts/removeacct', single_user], stdin=yes_exec.stdout, stdout=subprocess.PIPE) # Closing stdout is important in avoiding SIGPIPE errors per documentation. yes_exec.stdout.close() print removeacct_exec.communicate()[0]