Scripts may fail when executed by policy
If scripts fail when executed by CPM, but succeed when executed via terminal, please download CPM logs and search for the following message:
INFO: backup_function_internal(.\cpmagent\agent.py:<line number>) After pre snapshot. script_logs: [{'log': 'Pseudo-terminal will not be allocated because stdin is not a terminal.\r\nsudo: sorry, you must have a tty to run sudo\n', 'title': u'Before Snapshot Start Script'}]
If you have found it, you can resolve it by one of the 3 options below:
Edit /etc/sudoers by commenting Defaults requiretty to #Defaults requiretty Or
If you don't want to disable requiretty globally, you can disable it for a specific user, you can edit /etc/sudoers for a specific user only such as below
Defaults requiretty
Defaults:your_username_goes_here !requiretty Or
Change the -t option to either -tt or -ttt
ssh -i rsa_file.pem -ttt cpmuser@remote_server "sudo script_name.sh"
Below are 2 links to sources which demonstrate the above solutions:
Related Articles
Troubleshooting Linux scripts in CPM
In order to troubleshoot scripts, you need to connect to the CPM instance over SSH (using user "cpmuser") and execute the scripts from command line. Please do not use "su" or "sudo", as CPM doesn't elevate permissions. If when you run the script you ...
Backup scripts may fail after upgrading to CPM 2.3.0
If you have partially successful backups after upgrading your CPM to v2.3.x or newer, please open the backup log and search for the below: Error - Could not find script "before_<Policy Name>", will continue without backup scripts If you have found ...
How to increase the VSS/scripts timeout on CPM 2.1 and higher
VSS timeout controls two parameters: 1) How long can a VSS operation take. 2) How much time can pass between VSS operations (e.g how much time can a snapshot take). In v3.x, this setting can be configured in "Policy Instance and Volume Configuration" ...
Linux scripts may start failing after upgrading to a new CPM version (using AMI) or migrating CPM to a different account/region
Linux scripts may start failing after upgrading to a new CPM version (using AMI) or migrating CPM to a different account/region. In order to restore scripts' functionality, please run a script from command line, and approve the SSH key by answering ...
CPM may fail to add RDS to a policy, if any of the displayed RDS instances have an "inaccessible-encryption-credentials" status
CPM may fail to add RDS to a policy, if any of the displayed RDS instances has a "inaccessible-encryption-credentials" status The "inaccessible-encryption-credentials" status is visible in the EC2 Console, in the CPM GUI it's displayed as "Ensure ...