Skip to content

Commit e7e87b3

Browse files
committed
Merge pull request #3 from tilfin/feature/add_hostname
Add hostname
2 parents 6447c1d + 12a1317 commit e7e87b3

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

backup

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ fi
111111
#
112112
# Start
113113
#
114-
echo "Day Index: $dayidx Bucket: $bucket" | tee $logfile
115-
echo "Backup start at `date`." | tee -a $logfile
114+
echo "Day Index: $dayidx" | tee $logfile
115+
echo "Bucket: $bucket" | tee -a $logfile
116+
echo "Host: `hostname`" | tee -a $logfile
117+
echo "Backup start at `date`." | tee -a $logfile
116118

117119

118120
#

test/bats

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ teardown() {
1717
@test "invoking backup without config file" {
1818
run backup
1919
[ "$status" -eq 0 ]
20-
[ "${lines[2]}" = "[OK] S01command" ]
21-
[ "${lines[3]}" = "Start to synchronize files to cloud." ]
22-
[ "${lines[4]}" = "srcdir : /tmp/backup-temp" ]
23-
[ "${lines[5]}" = "bucket : storage" ]
24-
[ "${lines[6]}" = "destdir: destination" ]
25-
[ "${lines[7]}" = "[OK] Sync" ]
20+
[ "${lines[4]}" = "[OK] S01command" ]
21+
[ "${lines[5]}" = "Start to synchronize files to cloud." ]
22+
[ "${lines[6]}" = "srcdir : /tmp/backup-temp" ]
23+
[ "${lines[7]}" = "bucket : storage" ]
24+
[ "${lines[8]}" = "destdir: destination" ]
25+
[ "${lines[9]}" = "[OK] Sync" ]
2626
}
2727

2828
@test "invoking backup with valid config file" {
2929
run backup -f $confdir/valid.conf
3030
[ "$status" -eq 0 ]
31-
[ "${lines[2]}" = "[OK] S01command" ]
32-
[ "${lines[3]}" = "Start to synchronize files to cloud." ]
33-
[ "${lines[4]}" = "srcdir : /tmp/backup-temp" ]
34-
[ "${lines[5]}" = "bucket : storage" ]
35-
[ "${lines[6]}" = "destdir: destination" ]
36-
[ "${lines[7]}" = "[OK] Sync" ]
31+
[ "${lines[4]}" = "[OK] S01command" ]
32+
[ "${lines[5]}" = "Start to synchronize files to cloud." ]
33+
[ "${lines[6]}" = "srcdir : /tmp/backup-temp" ]
34+
[ "${lines[7]}" = "bucket : storage" ]
35+
[ "${lines[8]}" = "destdir: destination" ]
36+
[ "${lines[9]}" = "[OK] Sync" ]
3737
}
3838

3939
@test "invoking backup with config file that does not exist" {
@@ -64,24 +64,24 @@ teardown() {
6464
run backup -n
6565
[ "$status" -eq 0 ]
6666
[ "${lines[0]}" = "Dry run!" ]
67-
[ "${lines[3]}" = "[OK] S01command" ]
68-
[ "${lines[4]}" = "Start to synchronize files to cloud." ]
69-
[ "${lines[5]}" = "srcdir : /tmp/backup-temp" ]
70-
[ "${lines[6]}" = "bucket : storage" ]
71-
[ "${lines[7]}" = "destdir: destination" ]
72-
[ "${lines[8]}" = "dry run backup" ]
73-
[ "${lines[9]}" = "[OK] Sync" ]
67+
[ "${lines[5]}" = "[OK] S01command" ]
68+
[ "${lines[6]}" = "Start to synchronize files to cloud." ]
69+
[ "${lines[7]}" = "srcdir : /tmp/backup-temp" ]
70+
[ "${lines[8]}" = "bucket : storage" ]
71+
[ "${lines[9]}" = "destdir: destination" ]
72+
[ "${lines[10]}" = "dry run backup" ]
73+
[ "${lines[11]}" = "[OK] Sync" ]
7474
}
7575

7676
@test "invoking dry run backup with config file" {
7777
run backup -n -f $confdir/valid.conf
7878
[ "$status" -eq 0 ]
7979
[ "${lines[0]}" = "Dry run!" ]
80-
[ "${lines[3]}" = "[OK] S01command" ]
81-
[ "${lines[4]}" = "Start to synchronize files to cloud." ]
82-
[ "${lines[5]}" = "srcdir : /tmp/backup-temp" ]
83-
[ "${lines[6]}" = "bucket : storage" ]
84-
[ "${lines[7]}" = "destdir: destination" ]
85-
[ "${lines[8]}" = "dry run backup" ]
86-
[ "${lines[9]}" = "[OK] Sync" ]
80+
[ "${lines[5]}" = "[OK] S01command" ]
81+
[ "${lines[6]}" = "Start to synchronize files to cloud." ]
82+
[ "${lines[7]}" = "srcdir : /tmp/backup-temp" ]
83+
[ "${lines[8]}" = "bucket : storage" ]
84+
[ "${lines[9]}" = "destdir: destination" ]
85+
[ "${lines[10]}" = "dry run backup" ]
86+
[ "${lines[11]}" = "[OK] Sync" ]
8787
}

0 commit comments

Comments
 (0)