Add README and cleanup the script

This commit is contained in:
Benjamin Renard 2017-03-06 17:17:22 +01:00
parent 21030f2a02
commit f2ce80cf2b
2 changed files with 70 additions and 36 deletions

34
README.md Normal file
View file

@ -0,0 +1,34 @@
Script to queue backup in BackupPC from command line
====================================================
This script permit to queue backup (for all or specified host(s)) in BackupPC from
command line. It's provide parameters permiting :
* to specify witch type of backup to queue (full or incr) ;
* to specify as wich user the backup is run for BackupPC ;
* to stop running backup instead of starting new one, and how many hour(s) BackupPC could not start automatically backup ;
Usage
-----
'''
backuppcQueueBackup
Script to queue backup in BackupPC from command line
Options:
--verbose,-v Increase verbosity
--help,-h Display this message
--hostname,-H Only queue backup for the specified host
--exclude,-x Do not queue backup for the specified host
--all,-a queue backup for all BackupPC hosts
--start-first,-f Start first queuing backup for this specified host(s)
--includeBackupsDisableHosts Queue backup for all BackupPC hosts
--type,-t Backup type : full or incr
--user,-u BackupPC user that doing this action for BackupPC
--stop Stop Backup instead of queuing new one
--backoff During stop Backup action, say BackupPC do not automatically
start backup during next x hour(s) (Default : 1 hour(s))
--dry-run,-j Perform a trial run (do nothing real)
'''

View file

@ -42,7 +42,7 @@ $goodOpt = GetOptions(
if ($all == 0 && $#hostsDesired < 0 && $#hostsExcluded < 0) { if ($all == 0 && $#hostsDesired < 0 && $#hostsExcluded < 0) {
print " ERROR : You must specify on witch host(s) you want to queue backup using\n"; print " ERROR : You must specify on witch host(s) you want to queue backup using\n";
print " at least one of --all, --hostname or --exclude parameters.\n"; print " at least one of --all, --hostname or --exclude parameters.\n\n";
$goodOpt=0; $goodOpt=0;
} }
@ -57,21 +57,21 @@ if ($opt_t ne "full" && $opt_t ne "incr") {
} }
if ($opt_h or not $goodOpt) { if ($opt_h or not $goodOpt) {
print "BackupPC_queue_backup\n\n"; print "backuppcQueueBackup\n\n";
print "Script to queue backup in BackupPC internal queue\n\n"; print "Script to queue backup in BackupPC internal queue\n\n";
print "Options:\n"; print "Options:\n";
print " --verbose,-v increase verbosity\n"; print " --verbose,-v Increase verbosity\n";
print " --help,-h display this message\n\n"; print " --help,-h Display this message\n\n";
print " --hostname,-H only queue backup for the specified host\n"; print " --hostname,-H Only queue backup for the specified host\n";
print " --exclude,-x do not queue backup for the specified host\n"; print " --exclude,-x Do not queue backup for the specified host\n";
print " --all,-a queue backup for all BackupPC hosts\n"; print " --all,-a Queue backup for all BackupPC hosts\n";
print " --start-first,-f Start first queuing backup for this specified host(s)\n"; print " --start-first,-f Start first queuing backup for this specified host(s)\n";
print " --includeBackupsDisableHosts queue backup for all BackupPC hosts\n"; print " --includeBackupsDisableHosts Queue backup for all BackupPC hosts\n";
print " --type,-t Backup type : full or incr\n"; print " --type,-t Backup type : full or incr\n";
print " --user,-u BackupPC user that doing this action for BackupPC\n"; print " --user,-u BackupPC user that doing this action for BackupPC\n";
print " --stop Stop Backup instead of queuing new one\n"; print " --stop Stop Backup instead of queuing new one\n";
print " --backoff During stop Backup action, say BackupPC do not automatically\n"; print " --backoff During stop Backup action, say BackupPC do not automatically\n";
print " start backup during next x hour(s) (Default : $stop_backoff hour(s))\n"; print " Start backup during next x hour(s)\n";
print " --dry-run,-j Perform a trial run (do nothing real)\n"; print " --dry-run,-j Perform a trial run (do nothing real)\n";
exit 0 if $goodOpt; exit 0 if $goodOpt;
exit 1; exit 1;