I'm trying to create a hook that will enable CloudLinux Reseller Limits and set the limits for the reseller account when it is created and uses a specific reseller plan/package.
This is what I have but it is not working:
I've created other cPanel hooks, so I have the basics and it is created correctly in hooks, etc.
Perl is definitely not my expertise, so I'm struggling to get this to work.
Any help would be awesome!
Thanks!
This is what I have but it is not working:
Code:
#!/usr/local/cpanel/3rdparty/bin/perl
package NewAccountHook;
use strict;
use warnings;
sub describe {
my $hook = {
'category' => 'Whostmgr',
'event' => 'Accounts::Create',
'stage' => 'post',
'hook' => 'NewAccountHook::actions',
'exectype' => 'module',
};
return $hook;
}
sub actions {
my ( $context, $data ) = @_;
my $user = $data->{'user'};
my $plan = $data->{'plan'};
if ( $plan eq 'Reseller Plan 1' ) {
system`/sbin/cloudlinux-limits enable-reseller-limits --reseller-name $user --json`;
system`/sbin/cloudlinux-limits set --reseller-name $user --speed=100% --pmem=3G --nproc=200 --maxEntryProcs=30 --iops=5024 --io=100MB/s --json`;
} elsif ( $plan eq 'Reseller Plan 2' ) {
system`/sbin/cloudlinux-limits enable-reseller-limits --reseller-name $user --json`;
system`/sbin/cloudlinux-limits set --reseller-name $user --speed=150% --pmem=5G --nproc=200 --maxEntryProcs=50 --iops=7024 --io=250MB/s --json`;
} else {
# Executes when the none of the above condition is true
}
}
1;
Perl is definitely not my expertise, so I'm struggling to get this to work.
Any help would be awesome!
Thanks!