We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
How can I test and debug recipes?
Answer
On Unix systems, simply copy the content of the recipe script into the file located on remote machine, make it executable (chmod +x script_file) and run it.
For linux/Unix based VMs also check:
https://onapp.zendesk.com/entries/30070217-Add-live-logging-capabilities-to-your-Recipe-on-Linux-VS
https://onapp.zendesk.com/entries/30497156-How-to-check-what-the-recipe-is-executing-on-my-Linux-VS
On Windows systems, copy the recipe script to destination machine. Connect to the machine via SSH from the onapp user on the Control Panel server:
su onapp
ssh SvcCOPSSH@xxx.xxx.xxx.xxx for 3.x based templates
ssh Administrator@xxx.xxx.xxx.xxx for 4.x based template
You will be taken to a terminal.
3. Run:
BAT:
cmd /Q /C "CALL script_file"
Vbs:
cmd /C "CALL CScript.exe script_file //Nologo"
PowerShell:
cmd /C "CALL %windir%\System32\
WindowsPowerShell\v1.0\powershell -InputFormat None -NonInteractive -NoLogo Set-ExecutionPolicy Unrestricted"
cmd /C "CALL %windir%\System32\WindowsPowerShell\v1.0\powershell -InputFormat None -NonInteractive -NoLogo -File script_file"
Try to run your scripts this way before creating a recipe. This will ensure they are working via SSH and that you have enough permissions to perform the desired actions.
When running a recipe, you can also gather useful output with the following command, whilst the recipe is in progress from your Control Panel server:
tail -f /onapp/interface/log/onapp.err