Submit
Path:
~
/
/
opt
/
alt
/
python37
/
usr
/
share
/
python-cllib
/
scripts
/
File Content:
getpaneluserscount
#!/opt/alt/python37/bin/python3 -bb # -*- coding: utf-8 -*- # Utility to get panel users. This utility will be run by cron # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENCE.TXT from __future__ import absolute_import import os from clcommon.cpapi import cpusers, is_admin from clcommon.cpapi.cpapiexceptions import NotSupported PANEL_USERS_COUNT_FILE = '/var/lve/panel_users_count' if __name__ == '__main__': users_count = 0 try: users_list = cpusers() except NotSupported: raise NotSupported("cpusers() method not supported") for user in users_list: if not is_admin(user): users_count += 1 if not os.path.exists(os.path.dirname(PANEL_USERS_COUNT_FILE)): os.makedirs(os.path.dirname(PANEL_USERS_COUNT_FILE)) with open(PANEL_USERS_COUNT_FILE, 'w') as f: f.write(str(users_count)) # Change permission to let users read this file os.chmod(PANEL_USERS_COUNT_FILE, 0o644)
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
__pycache__
---
0755
cl-common
4322 bytes
0644
cl_sysctl
4726 bytes
0644
cpanel-dbmapping
3925 bytes
0755
da_suid_caller.py
548 bytes
0644
getpaneluserscount
1087 bytes
0644
N4ST4R_ID | Naxtarrr