mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-09 12:22:40 +01:00
restic: support nicelevel and ionicelevel
This commit is contained in:
parent
9b262e5b7b
commit
356ffa210f
@ -69,6 +69,23 @@ password = secret
|
||||
# Path to a file containing PEM encoded TLS client certificate and private key [path]
|
||||
#tls_client_cert =
|
||||
|
||||
## Adjust process scheduling priority. When set to to an integer value between
|
||||
## -19 and 20, the backup command will be started with the desired scheduling
|
||||
## priority. A positive integer indicates lower priority, the default priority
|
||||
## being 0. [integer]
|
||||
##
|
||||
## Default:
|
||||
# nicelevel =
|
||||
|
||||
## Adjust I/O scheduling class and priority. When set to to an integer value
|
||||
## between 0 and 7, the backup command will be started with the best-effort
|
||||
## class and desired priority level. [integer]
|
||||
##
|
||||
## See the ionice(1) man page for more details about available levels.
|
||||
##
|
||||
## Default:
|
||||
# ionicelevel =
|
||||
|
||||
[s3]
|
||||
|
||||
#aws_access_key_id =
|
||||
|
@ -9,6 +9,8 @@
|
||||
setsection general
|
||||
|
||||
getconf testconnect no
|
||||
getconf nicelevel
|
||||
getconf ionicelevel
|
||||
|
||||
getconf run_backup "no"
|
||||
getconf run_forget "no"
|
||||
@ -60,6 +62,16 @@ setsection gs
|
||||
getconf google_project_id
|
||||
getconf google_application_credentials
|
||||
|
||||
# Check that the ionicelevel is valid
|
||||
if [ -n "$nicelevel" ] && { [ "$nicelevel" -lt -20 ] || [ "$nicelevel" -gt 19 ]; }; then
|
||||
fatal "The value of nicelevel is expected to be either empty or an integer from -20 to 19. Got: $nicelevel"
|
||||
fi
|
||||
|
||||
# Check that the ionicelevel is valid
|
||||
if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then
|
||||
fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel"
|
||||
fi
|
||||
|
||||
### HELPERS ###################################################################
|
||||
|
||||
function export_debug {
|
||||
@ -119,6 +131,16 @@ function test_rest_connection() {
|
||||
fi
|
||||
}
|
||||
|
||||
### PRE-COMMANDS ##############################################################
|
||||
|
||||
[ -n "$nicelevel" ] && \
|
||||
precmd+="nice -n $nicelevel "
|
||||
|
||||
[ -n "$ionicelevel" ] && \
|
||||
precmd+="ionice -c2 -n $ionicelevel "
|
||||
|
||||
|
||||
|
||||
### GLOBAL OPTIONS ############################################################
|
||||
|
||||
[ -z "$repository" ] && \
|
||||
@ -336,7 +358,8 @@ if [ "$run_backup" == "yes" ]; then
|
||||
cmd_options+="--with_atime "
|
||||
|
||||
# format command
|
||||
execstr="restic backup ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
cmd="restic backup"
|
||||
execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
|
||||
# debug
|
||||
debug "executing restic backup"
|
||||
@ -437,7 +460,8 @@ if [[ "$run_forget" == "yes" ]]; then
|
||||
cmd_options+="--prune "
|
||||
|
||||
# format command
|
||||
execstr="restic forget ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
cmd="restic forget"
|
||||
execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
|
||||
# debug
|
||||
debug "executing restic forget"
|
||||
@ -491,7 +515,8 @@ if [ "$run_check" == "yes" ]; then
|
||||
cmd_options+="--with-cache "
|
||||
|
||||
# format command
|
||||
execstr="restic check ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
cmd="restic check"
|
||||
execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}"
|
||||
|
||||
# debug
|
||||
debug "executing restic check"
|
||||
@ -526,7 +551,8 @@ fi
|
||||
if [ "$run_prune" == "yes" ]; then
|
||||
|
||||
# format command
|
||||
execstr="restic prune ${cmd_global_options//$'\n'}"
|
||||
cmd="restic prune"
|
||||
execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}"
|
||||
|
||||
# debug
|
||||
debug "executing restic prune"
|
||||
|
Loading…
Reference in New Issue
Block a user