• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

CLI: schedulled backup

EveMauta

Basic Pleskian
Hi,
I'm looking to set up a schedulled backup from command line.
I haven't found the correct command, could you tell me if it's possible and how ?

Additional question: I'm looking too, to set for the server the max number backup file to save, do you know how to do it from cli ?

Thanks you very much.

Best regards
Eve
 
Hi UFHH01,

Well I already read this documentation, and do a lot of search about this before posting here.
I'm not talking about doing a backup but how to configure a Scheduled backup.

The only thing a found is the mysql request to see backup configured (In this forum):
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e 'select * from BackupsScheduled;'



The goal is to set the number of backup before rotation for the server, and to be able to set a scheduled backup job.

Best regards
Eve
 
Hi EveMauta,

... not that difficult, I think... just create the cronjobs ( scheduled tasks ) with the desired backup - specifications, before the daily maintenance routine - there is no need to use the psa - database for this, because the daily maintenance is defined over cronjobs ( /etc/cron.daily/50plesk-daily - /etc/cron.weekly/50plesk-weekly - /etc/cron.monthly/50plesk-monthly ). These daily/weekly/monthly cronjobs are executed by the crontabs ( /etc/crontab )

... test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
... test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
... test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
 
Hi,

Maybe I can't understand what you are telling me...
Anyway my goal is to use cli command to add in plesk scheduled backup (Display in plesk).

Do you know some solution for this ?

Best regards
Eve


PS:
-------------------------------------------------------------------------------------------
cat /etc/cron.daily/50plesk-daily
#!/bin/sh
### Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.

# install_statistics
/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php >/dev/null 2>&1

# install_mysqldump
/usr/local/psa/bin/mysqldump.sh >/dev/null 2>&1
-------------------------------------------------------------------------------------------
cat /etc/cron.weekly/50plesk-weekly
#!/bin/sh
### Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.

/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php weekly >/dev/null 2>&1
-------------------------------------------------------------------------------------------
cat /etc/cron.monthly/50plesk-monthly
#!/bin/sh
### Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.

/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php monthly >/dev/null 2>&1
-----------------------------------------------------------
cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
-----------------------------------------------------------
cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
-----------------------------------------------------------
-----------------------------------------------------------
 
Hi EveMauta,

it is hard to understand, why you re-post the existing cronjobs, while you want to achieve NEW cronjobs to the actual existing ones, but anyway.....:


If you have issues, please provide YOUR actual command(s), that you would like to use and try to describe, WHAT doesn't work in your eyes as expected. If your commands result in an error message, please provide as well the error(s) from the command line for investigations.
 
Hi,
Really simple I'm looking to set up Scheduled backup as we can do by Plesk GUI but by CLI.
Do you know if it's possible to do something like what ?
(With this command: /usr/local/psa/bin/pleskbackup can't find the way to do something like what).
(With cron as you point me I haven't found something I could use to do this task).

At the same time I'm looking too to set the number of backup before rotation for the server by cli too.

Best regards
Vince
 
Hi EveMauta,

please have a look at "http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/" to learn some basics about how to create a cronjob.

A common entry for a pleskbackup ( including the transfer to another FTP - server ) could be:

00 23 * * * root /usr/local/psa/bin/pleskbackup –server -v --output-file=ftp://your_ftp_server.com/your_folder --ftp-login=USER-NAME --ftp-password=USER-PASSWORD >/dev/null 2>&1

... which would setup a cronjob each day, at 11:00 pm for a complete server backup, without eMail - notification.


There is no cli - command in Plesk ( as far that I know ), that offers the possibility to setup cronjobs, but you could create as well a bash script, which includes all your desired tasks/commands and add this instead of the example above.


From my point of view, it is far easier and faster to use the Plesk Control Panel to setup such tasks, even if you setup several servers at once. ;)
 
Hi UFHH01,
Goal was to deploy lot of server by script, for gain time...
Anyway thanks for your answer, I will try some Database insert to see if this do the job ;)
Best regards
Eve
 
Back
Top