-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup.h
51 lines (41 loc) · 1.27 KB
/
backup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2024 Hicham Saidi
// All rights reserved.
#ifndef BACKUP_H_ /* Include guard */
#define BACKUP_H_
#include <stdio.h>
#include <stdlib.h>
#include "basher.h"
/*
In this function you will find all the backup functions
void full_backup(const char* path);
void incremental_backup(const char* path);
void differential_backup(const char* path);
----> Here path is where is the data to backup.
*/
/*
DESTINATION="/etc/backup"
# Create backup directories if they don't exist
mkdir -p "$DESTINATION/full" "$DESTINATION/incremental" "$DESTINATION/differential"
*/
// This will do a Full Back up
void full_backup(const char* path) {
// Construct the command string
char command[1024];
snprintf(command, sizeof(command), "sudo ./backup.sh %s 1", path);
execute_command(command);
}
// This will do an Incremental back up
void incremental_backup(const char* path) {
// Construct the command string
char command[1024];
snprintf(command, sizeof(command), "sudo ./backup.sh %s 2", path);
execute_command(command);
}
// This will do a Differential Back up
void differential_backup(const char* path) {
// Construct the command string
char command[1024];
snprintf(command, sizeof(command), "sudo ./backup.sh %s 3", path);
execute_command(command);
}
#endif