-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackup_user_archive.pl
More file actions
49 lines (45 loc) · 1.4 KB
/
backup_user_archive.pl
File metadata and controls
49 lines (45 loc) · 1.4 KB
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
#!/usr/bin/perl
#
# @author Gerhard Steinbeis (info [at] tinned-software [dot] net)
# @copyright Copyright (c) 2014
$version_3 = ".01";
# @license http://opensource.org/licenses/GPL-3.0 GNU General Public License, version 3
# @package backup
#
# Return version information
if($version_check eq "1") {return $version_1;}
if($ARGV[0] eq "-v"){
print "\n";
print "Backup User Archive Config\n";
print " Version 0$version_3\n";
print " Copyright 2014 by Gerhard Steinbeis\n";
return true;
}
# create archive for each user directory
#
# This subroutine will generate a seperate configuration item for each
# directory under /home/. This result in seperate archives for each users.
# Just call the subroutine from within the "Backup directories" section.
#
# user_archives();
#
sub user_archives {
# get the directories of the users
$shell_find = `find /home/* -maxdepth 0 -type d`;
$exit_value = $? >> 8;
if($exit_value){
$err_txt = "(config) find error:\n $find\n";
do($backup_error);
}
#Create configuration details fro each home directory
@folders = split("\n",$shell_find);
foreach $directory (@folders){
$bc = $bc + 1;
$source_dir[$bc] = $directory;
$directory =~ s/\//_/g;
$directory =~ s/^_//;
$archive_name[$bc] = $directory;
$ignore_pattern[$bc] = "";
}
}
1;