%PDF- %PDF-
Direktori : /proc/self/root/opt/alt/python37/usr/share/python-cllib/scripts/ |
Current File : //proc/self/root/opt/alt/python37/usr/share/python-cllib/scripts/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)