| Server IP : 172.67.216.113 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/2388322/root/opt/alt/python37/usr/share/python-cllib/scripts/ |
Upload File : |
#!/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)