Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the copy-the-code domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pb-seo-friendly-images domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the johannes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121
Execute custom script after cPanel updates - PC✗3
Execute custom script after cPanel updates

Execute custom script after cPanel updates

cPanel update script that is executed every night is /scripts/upcp and according to its code, file named /scripts/postupcp will get executed at the end:

if (-e "/scripts/postupcp") {
   system("/scripts/postupcp");
}

We can use this file to add a custom command that will execute after the update.

Cloudlinux already uses it:

cat /scripts/postupcp
#!/bin/bash
/usr/share/cloudlinux-linksafe/cpanel/hooks/cloudlinux_linksafe_hook.sh   #cloudlinux-linksafe
/usr/share/l.v.e-manager/cpanel/hooks/l.v.e-manager_postupcp_hook.sh   #l.v.e-manager
/usr/share/cagefs/cpanel/cagefs_postupcp_hook.sh   #CageFS Version 2.0. Update CageFS after update of CPanel
/usr/share/lve/dbgovernor/cpanel/upgrade-mysql-disabler.sh   #dbgovernor

If the file does not exist, create it and add your custom script:

nano /scripts/postupcp
/usr/share/something-custom/run-after-update.sh   #my custom script

We can even use our custom install script to add code to the /scripts/postupcp

line_to_add="/usr/share/something-custom/run-after-update.sh   #my custom script"

# Check if already added, if not add it
if ! grep -qF "$line_to_add" /scripts/postupcp; then
  echo "$line_to_add" >> /scripts/postupcp
fi
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.