Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
backupninja
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Petr Klíma
backupninja
Commits
76b457cc
Commit
76b457cc
authored
4 years ago
by
Jérôme Charaoui
Browse files
Options
Downloads
Patches
Plain Diff
raise error if mail isn't found in $PATH and reportemail = yes
parent
6937842e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
src/backupninja.in
+27
-22
27 additions, 22 deletions
src/backupninja.in
test/backupninja.bats
+15
-2
15 additions, 2 deletions
test/backupninja.bats
with
46 additions
and
24 deletions
CHANGELOG.md
+
4
−
0
View file @
76b457cc
...
...
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
-
[core] raise error if mail isn't found in $PATH and reportemail = yes
### Fixed
-
[build] make build reproducible regardless of usrmerge (DEBBUG-915222)
...
...
This diff is collapsed.
Click to expand it.
src/backupninja.in
+
27
−
22
View file @
76b457cc
...
...
@@ -613,6 +613,7 @@ else doit=0
fi
if
[
$doit
==
1
]
;
then
if
[
-x
"
$(
which mail 2>/dev/null
)
"
]
;
then
debug
"send report to
$reportemail
"
hostname
=
`
hostname
`
[
$warnings
==
0
]
||
subject
=
"WARNING"
...
...
@@ -636,6 +637,10 @@ if [ $doit == 1 ]; then
done
fi
}
| mail
-s
"backupninja:
$hostname
$subject
"
$reportemail
else
error
"Unable to locate mail executable, email report not sent!"
let
"errors += 1"
fi
fi
if
[
$actions_run
!=
0
]
;
then
...
...
This diff is collapsed.
Click to expand it.
test/backupninja.bats
+
15
−
2
View file @
76b457cc
load common
teardown_backupninja() {
[ -x /usr/bin/mail.moved ] && mv /usr/bin/mail.moved /usr/bin/mail
}
create_test_action() {
echo '#!/bin/sh' > "${BATS_TMPDIR}/backup.d/test.sh"
echo "$1 $2" >> "${BATS_TMPDIR}/backup.d/test.sh"
...
...
@@ -92,7 +96,7 @@ create_test_action() {
}
@test "reports: report is mailed when reportsuccess = yes" {
create_test_action
create_test_action
info test_info
setconfig backupninja.conf reportsuccess yes
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
sleep 0.1
...
...
@@ -109,7 +113,7 @@ create_test_action() {
}
@test "reports: success report contains disk space info" {
create_test_action
create_test_action
info test_info
echo "directory = /" >> "${BATS_TMPDIR}/backup.d/test.sh"
setconfig backupninja.conf reportsuccess yes
setconfig backupninja.conf reportspace yes
...
...
@@ -118,6 +122,15 @@ create_test_action() {
grep -q "/dev/sda1" /var/mail/vagrant
}
@test "reports: emits error if mail executable is not found" {
create_test_action info test_info
setconfig backupninja.conf reportsuccess yes
mv /usr/bin/mail /usr/bin/mail.moved
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
[ "$status" -eq 1 ]
false
}
@test "scheduling: runs when = 'everyday at 01' and time matches" {
create_test_action info test_info
setconfig backupninja.conf when 'everyday at 01'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment