Scripts may fail when executed by policy

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:
  1. Edit /etc/sudoers by commenting Defaults    requiretty to #Defaults    requiretty Or
  2. 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
  3. 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: