Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
Is it possible to create scheduled backup tasks via CLI/API?
Answer
Such functionality is yet to be implemented in Plesk.
If you would like to see these features in Plesk, please vote for them on Plesk UserVoice:
Available workarounds:
A cron task can be added to schedule backups to a remote storage for example:
# echo '/usr/local/psa/bin/pleskbackup server --output-file=ftp://username:password@example.com/myfolder' > /etc/cron.weekly/99plesk-backup && chmod +x /etc/cron.weekly/99plesk-backup
Note: for the following, the usage of Powershell is required.
Run the following commands to schedule a server-wide daily backup at 1am for example:
PS C:> $action = New-ScheduledTaskAction -Execute 'C:\Windows\system32\cmd.exe' -Argument '/c "plesk bin pleskbackup --server"'
PS C:> $trigger = New-ScheduledTaskTrigger -Daily -At 1am
PS C:> $principal = New-ScheduledTaskPrincipal -UserId SYSTEM
PS C:> Register-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -TaskName "Daily Backup at 1am"
Create an extension to schedule tasks following our documentation: How to Create and Install Extensions and Extension SDK documentation: Scheduling Tasks
Comments
2 comments
Is it possible to send backups to S3 via CLI?
Hello,
Yes, you can configure to back a server up to an FTP storage using the "ftp-login" option of 'pleskbackup' CLI utility. You can read more about that in our documentation:
https://docs.plesk.com/en-US/onyx/cli-linux/using-command-line-utilities/pleskbackup-backing-up-content-and-configuration.74260/
The command will look like
\# plesk bin pleskbackup server --ftp-login=ftpuser1
You can also find the information on how to configure Amazon S3 to connect via FTP protocol on stackoverflow:
https://stackoverflow.com/questions/23939179/ftp-sftp-access-to-an-amazon-s3-bucket
Please sign in to leave a comment.