• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Events not working?

P

PedstersPlanet

Guest
Ok, I have a Event in Event manager that disables a domain if the traffic limit is reached.. however, it didnt execute?

Am I right in thinking that you have to run it as the user of the domain and not root?

----------
Event: Traffic limit reached for domain
Priority: 50
User: <client user>
/usr/local/psa/admin/sbin/domainmng --turn-off --domain-name=<full domain name here>
-----------

Is this right? I can not see why it wouldnt work, unless its a permission error on the domainmng - if so, how do you tell which domain exceeds limit if its executed under root?

Or am I missing something here?
 
I found the problem:
Jan 14 04:12:09 Event manager[24833]: Can't execute /usr/local/psa/admin/sbin/domainmng: Permission denied
So how can I turn the domain off under the user the domain belongs to?
There must be a way?
 
/usr/local/psa/admin/sbin/domainmng

-r-xr-x--- 1 root psaadm 2893044 Aug 24 08:28 domainmng

it can only be run by users root or psaadm

just run it as one of those users.
 
Originally posted by dhthwy
/usr/local/psa/admin/sbin/domainmng
-r-xr-x--- 1 root psaadm 2893044 Aug 24 08:28 domainmng
it can only be run by users root or psaadm
just run it as one of those users.
Ok, if I run it as root, then how will I know which domain has maxed its limits, using the 'Traffic limit for domain reached' event?
Or is there a way to check for all domains by default?
 
btw domains are unique and can't be shared by other clients so you won't have to worry about what domain belongs to what user.
 
when any domain has reached its limit plesk will notify the event manager and it will call the event you have made.
 
Originally posted by dhthwy
when any domain has reached its limit plesk will notify the event manager and it will call the event you have made.
Sorry if I soundthick lol, but IIRC, domainmng needs a domain name in the --domain-name= argument yes, so if I run the domainmng as root, then what do i add to the --domain-name= argument?
Or is there a way, via a script, to check each domains with domainmng.

I would always thought that when a domain has maxed any limit, it'll automatically disable domains (as per their documentation), but it doesnt.... That kind of defeats the object of having limits....
 
Ok, I'm stupid.......... lol....... I was making it asif it was harder to do than it is lol.... thanks

One final question...... Can we run the statistics say every 10 minutes, so it updates for customer purposes? Or will it drain a lot resources? As a new customer thought that my statistics were broken, as they uploaded 350mb but the stats stil were 0mb....
 
statistic generation seems to be handled by /usr/local/psa/admin/sbin/statistics so you could try setting up a cron job for it.

im new to plesk myself so im not sure if this will work. someone with more knowledge of plesk would be better to answer your question.

calling it with no arguments generates stats for all domains.
if load becomes an issue you could try adding a custom button to the control panel thatll update stats for a single domain.

statistics --calculate-one --domain-name=

i see some errors when i run it manually from the command line so it might not work.... try it out and see.

*/10 * * * * /usr/local/psa/admin/sbin/statistics >> /usr/local/psa/var/log/stats.out.log 2>&1
 
Back
Top