SSH commands
Popular use cases include pulling changes from a Git repository, performing backups, and running PHP Composer on the server.
You can define multiple lines of commands that altogether will be run as a single script. Configuration is similar to the SFTP action and requires providing server details, authorization data, and the commands to run:
Image loading...
Execution mode 1: Run as script
This is the default running mode. You can choose between SH or BASH-specific syntax, and use Buddy variables and parameters in the commands and URLs.
Execution mode 2: Line by line
Warning
This mode is not recommended and should only be used if Base64 is not installed on the server.
Upon selecting this mode, the commands will be run in non-interactive mode. This means that:
- Each line is executed in the context of the working directory (default: user’s home dir).
- Lines are executed from top to bottom.
- Each command should be one separate line.
- If a command fails, the next line will not be executed and the action will fail (unless you check ignore errors)- Use absolute paths: the cd command will not be carried to the next line.
- You can use Buddy specific variables and parameters in commands and URL's.
- Environment variables between lines are not shared.
- If you want to use a more complex script, it is advised to call it from the server side (make sure the exit code it returns is correct).
Last modified on Sep 23, 2024