On 27/2/21 03:31, backu...@kosowsky.org wrote:
Adam Goryachev via BackupPC-users wrote at about 00:41:40 +1100 on Saturday,
February 27, 2021:
> Also, I was thinking it should be possible to have this script in a
> single file, and then just include or require it for each host, does
> that work? That would make the config file look a lot cleaner, and
> updating the script in a single file is better than updating for each host.
Specifically I do things like the following:
my $jhost = $_[1];
$Conf{BlackoutPeriods} = []
if $jhost =~ /^(machineA|machine[0-9]|othermachine)$/;
if($jhost =~ /^machineA)$/) {
$Conf{BackupsDisable} = 0; #Scheduled/automatic
}elsif($jhost =~/^ABCD$/) { #Specify hosts to disable
$Conf{BackupsDisable} = 2; #Disable
}elsif($jhost =~/machine[0-9]*$/) { #
$Conf{BackupsDisable} = 2; #CHANGE TO 1 to enable manual
}
etc.
Such logic can be continued for any differences between machines...
Ouch, that looks overly complex... it means mixing configs from
different hosts into the same "script". I'll look into these more
advanced options after I get the simple version working. I'm thinking
something as simple as:
require ./windows_shadow.pl;
> I was missing the ClientShareName2Path. I've added that in, but now I
> get another error:
>
> No such NTFS drive 'c:' skipping corresponding shadow setup...
> 'c' => /cygdrive/c/shadow/c-20210226-234449
> Eval return value: 1
>
> I'm thinking it might be a case sensitive issue, so am waiting for it to
> finish before adjusting the config and retrying:
> $Conf{RsyncShareName} = [
> 'C'
> ];
> $Conf{ClientShareName2Path} = {
> 'C' => '/C',
> };
>
> ie, using all capital C instead of the lower case c. Or are there any
> other hints?
>
It shouldn't be case sensitive.
And personally, I think I use lower case 'c'
Tell me what the following commands give:
# cygpath -u C:
# cygpath -u c:
# ls $(cygpath -u C:)/..
# ls $(cygpath -u c:)/..
# mount -m | grep "^C: "
# mount -m | grep "^c: "
Results:
$ cygpath -u C:
/cygdrive/c
$ cygpath -u c:
/cygdrive/c
$ ls $(cygpath -u C:)/..
c d
$ ls $(cygpath -u c:)/..
c d
$ mount -m | grep "^C: "
$ mount -m | grep "^c: "
$ mount -m
none /cygdrive cygdrive binary,posix=0,user 0 0
$ mount
C:/cygwin64/root/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/root/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64/root on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type udf (binary,posix=0,user,noumount,auto)
So all seem to work with lowercase or uppercase, but for some reason,
neither works when from the script.
The only "non-standard" thing I've done is all the cygwin tools are
installed to C:\cygwin64\root instead of the default which installs them
to C:\cygwin64\
OK, from re-checking the error and the script, it looks like it's
failing because mount -m doesn't show the c: ...
Thanks,
Adam
> I've also updated the script based on the new version you posted
> recently, though I'm assuming that won't make much difference to this issue.
>
> So, nope, that didn't work, I'll post more of the output below. I can
> manually login to the machine and run the command (from bash shell)
>
> $ wmic shadowcopy call create Volume=C:\\
> Executing (Win32_ShadowCopy)->create()
> Method execution successful.
> Out Parameters:
> instance of __PARAMETERS
> {
> ReturnValue = 0;
> ShadowID = "{2EB3E2AF-D099-44BA-8D43-A48B1760C73F}";
> };
>
> So it seems to suggest that it should work, most likely I'm again
> missing some obvious config, or doing something wrong, but seems it
> should be pretty close...
>
> Config file now has:
>
> $Conf{ClientNameAlias} = [
> '10.1.1.119'
> ];
> $Conf{XferMethod} = 'rsync';
> $Conf{RsyncdUserName} = 'BackupPC';
> $Conf{RsyncShareName} = [
> 'C'
> ];
> $Conf{ClientShareName2Path} = {
> 'C' => '/C',
> };
> $Conf{RsyncSshArgs} = [
> '-e',
> '$sshPath -l BackupPC'
> ];
> $Conf{RsyncClientPath} = '/cygdrive/c/cygwin64/root/bin/rsync.exe';
> $Conf{PingMaxMsec} = 100;
>
> Plus of course a copy of your script config file, updated today.
>
>
> Backup type: type = full, needs_full = , needs_incr = , lastFullTime =
> 1614263640, opts{f} = 1, opts{i} = , opts{F} =
> cmdSystemOrEval: about to system /bin/ping -c 1 -w 3 10.1.1.119
> cmdSystemOrEval: about to system /bin/ping -c 1 -w 3 10.1.1.119
> CheckHostAlive: ran '/bin/ping -c 1 -w 3 10.1.1.119'; returning 0.209
> XferLOG file /var/lib/backuppc/pc/hostvm2/XferLOG.1.z created 2021-02-27
> 00:30:13
> Backup prep: type = full, case = 6, inPlace = 1, doDuplicate = 0,
> newBkupNum = 1, newBkupIdx = 1, lastBkupNum = , lastBkupIdx = (FillCycle
> = 0, noFillCnt = 0)
> __bpc_progress_state__ pre-cmd
> Executing DumpPreUserCmd: &{sub {
> #Load variables
> my $hosttimestamp = "20210227.003013-keep";
> my $hostname = "keep";
> my $shadowdir = "/cygdrive/c/shadow/";
> my $shadows = "C";
>
> my $bashscript = "
> \ \ \ \ \ \ DAYS=2\
> \ \ \ \ \ \ AGE=\$\(\(\ \$\(date\ +%s\)\ -\ 86400\ \*\ \$DAYS\ \)\)\
> \ \ \ \ \ \ for\ II\ in\ \$\(\\ls\ -d\ ${shadowdir}\*\ 2\>/dev/null\)\;\ do\
> \ \ \ \ \ \ \ \ DATE=\$\(echo\ \$II\ \|\ sed\ -ne\
>
\"s/\^\[\^-\]\\+-\\\(\[0-9\]\\\{8\\\}\\\)\\.\\\(\[0-9\]\\\{2\\\}\\\)\\\(\[0-9\]\\\{2\\\}\\\)\\\(\[0-9\]\\\{2\\\}\\\)-$hostname\$/\\1\
> \\2:\\3:\\4/p\"\)\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$DATE\"\ -a\ \$\(date\ -d\ \"\$DATE\"\
> +%s\)\ -lt\ \$AGE\ \]\ \;\ then\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\ \$II\)\"\
> \ \ \ \ \ \ DRIVE=\$\{SHADOWLINK##\*\\\\\}\;\ DRIVE=\$\{DRIVE%%-\*\}\;\
> DRIVE=\"\$\{DRIVE\^\^\}:\"\
> \ \ \ \ \ \ SHADOWPATH=\$\(fsutil\ reparsepoint\ query\ \$SHADOWLINK\
> \|\ sed\ -ne\ \"s\|\^Print\
> Name:\[\[:space:\]\]\*\\\(.\*\\\)\\\\\\\\\\r\|\\1\|p\"\)\
> \ \ \ \ \ \ SHADOWID=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> path=\$\{SHADOWPATH//\\\\/\\\\\\\\\}\ \'path\ ==\ \$3\ \{print\ \$8\}\'\)\"\
> \ \ \ \ \ \ echo\ \"\ \ \ Deleting\ shadow\ for\ \'\$DRIVE\'\
> PATH=\$SHADOWPATH\;\ ID=\$SHADOWID\;\ LINK=\$SHADOWLINK\"\
> \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\ /quiet\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ shadow\ copy\
> for\ \'\$DRIVE\':\ \$SHADOWLINK\"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ link\ for\
> \'\$DRIVE\':\ \$SHADOWLINK\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ done\
> \ \ \ \ \ \ function\ errortrap\ \ \{\ \
> \ \ \ \ \ \ \ \ echo\ \"ERROR\ setting\ up\ shadows...\"\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$SHADOWID\"\ \]\;\ then\
> \ \ \ \ \ \ \ \ \ \ unset\ ERROR\
> \ \ \ \ \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\
> /quiet\ \|\|\ ERROR=\"ERROR\ \"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ \ \ echo\ \"\ \ \ \$\{ERROR\}Deleting\ shadow\ copy\
> for\ \'\$\{I\^\^\}:\'\ \$SHADOWID\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$SHADOWLINK\"\ \]\;\ then\
> \ \ \ \ \ \ \ \ \ \ unset\ ERROR\
> \ \ \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ ERROR=\"ERROR\ \"\
> \ \ \ \ \ \ \ \ \ \ echo\ \"\ \ \ \$\{ERROR\}Deleting\ shadow\ link\
> for\ \'\$\{I\^\^\}:\'\ \$SHADOWLINK\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ for\ II\ in\ \$\(\\ls\ -d\ ${shadowdir}\*-${hosttimestamp}\
> 2\>/dev/null\)\;\ do\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\ \$II\)\"\
> \ \ \ \ \ \ DRIVE=\$\{SHADOWLINK##\*\\\\\}\;\ DRIVE=\$\{DRIVE%%-\*\}\;\
> DRIVE=\"\$\{DRIVE\^\^\}:\"\
> \ \ \ \ \ \ SHADOWPATH=\$\(fsutil\ reparsepoint\ query\ \$SHADOWLINK\
> \|\ sed\ -ne\ \"s\|\^Print\
> Name:\[\[:space:\]\]\*\\\(.\*\\\)\\\\\\\\\\r\|\\1\|p\"\)\
> \ \ \ \ \ \ SHADOWID=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> path=\$\{SHADOWPATH//\\\\/\\\\\\\\\}\ \'path\ ==\ \$3\ \{print\ \$8\}\'\)\"\
> \ \ \ \ \ \ echo\ \"\ \ \ Deleting\ shadow\ for\ \'\$DRIVE\'\
> PATH=\$SHADOWPATH\;\ ID=\$SHADOWID\;\ LINK=\$SHADOWLINK\"\
> \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\ /quiet\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ shadow\ copy\
> for\ \'\$DRIVE\':\ \$SHADOWLINK\"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ link\ for\
> \'\$DRIVE\':\ \$SHADOWLINK\"\
> \ \ \ \ \ \ done\
> \ \ \ \ \ \ \ \ exit\ 1\ \
> \ \ \ \ \ \ \}\
> \ \ \ \ \ \ trap\ errortrap\ ERR\
> \ \ \ \ \ \ \[\ -n\ \"$shadows\"\ \]\ \&\&\ mkdir\ -p\ $shadowdir\
> \ \ \ \ \ \ for\ I\ in\ $shadows\;\ do\
> \ \ \ \ \ \ \ \ if\ !\ \[\ -d\ \"\$\(cygpath\ -u\ \$\{I\}:\)\"\ \]\
> \|\|\ !\ grep\ -qE\ \"\^\$\{I\^\^\}:\ \\S+\ ntfs\ \"\ \<\(mount\ -m\)\;\
> then\
> \ \ \ \ \ \ \ \ \ \ echo\ \"No\ such\ NTFS\ drive\ \'\$\{I\}:\'\
> skipping\ corresponding\ shadow\ setup...\"\
> \ \ \ \ \ \ \ \ \ \ continue\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ \{\ SHADOWID=\"\$\(wmic\ shadowcopy\ call\ create\
> Volume=\$\{I\}:\\\\\ \|\ sed\ -ne\ \'s\|\[\ \\t\]\*ShadowID\ =\
> \"\\\(\[\^\"\]\*\\\).\*\|\\1\|p\'\)\"\ \;\ \}\ 2\>\ \>\(tail\ +2\)\
> \ \ \ \ \ \ SHADOWPATH=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> id=\$SHADOWID\ \'id\ ==\ \$8\ \{print\ \$3\}\'\)\"\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\
> ${shadowdir}\)\$I-$hosttimestamp\"\
> \ \ \ \ \ \ cmd\ /c\ \"mklink\ /j\ \$SHADOWLINK\ \$SHADOWPATH\\\\\"\
> \ \ \ \ \ \ unset\ SHADOWID\ SHADOWPATH\ SHADOWLINK\
> \ \ \ \ \ \ done\
> ";
> #Run script $bashscript on remote host via ssh
> open(my $out_fh, "|-", "/usr/bin/ssh -q -x -i
> /var/lib/backuppc/.ssh/id_rsa -l BackupPC $args[0]->{hostIP} bash -s")
> or warn "Can't start ssh: $!";
> print $out_fh "$bashscript";
> close $out_fh or warn "Error flushing/closing pipe to ssh: $!";
> ;
>
> my $sharenameref=$bpc->{Conf}{ClientShareName2Path};
> foreach my $key (keys %{$sharenameref}) { #Rewrite
> ClientShareName2Path
> $sharenameref->{$key} = "$shadowdir$2-$hosttimestamp$3" if
> $sharenameref->{$key} =~
> m#^(/cygdrive)?/([a-zA-Z])(/.*)?$#; #Add shadow if letter drive
> }
> print map { " '$_' => $sharenameref->{$_}
> " } sort(keys %{$sharenameref}) unless $?;
> }}
> cmdSystemOrEval: about to eval perl code &{sub {
> #Load variables
> my $hosttimestamp = "20210227.003013-keep";
> my $hostname = "keep";
> my $shadowdir = "/cygdrive/c/shadow/";
> my $shadows = "C";
>
> my $bashscript = "
> \ \ \ \ \ \ DAYS=2\
> \ \ \ \ \ \ AGE=\$\(\(\ \$\(date\ +%s\)\ -\ 86400\ \*\ \$DAYS\ \)\)\
> \ \ \ \ \ \ for\ II\ in\ \$\(\\ls\ -d\ ${shadowdir}\*\ 2\>/dev/null\)\;\ do\
> \ \ \ \ \ \ \ \ DATE=\$\(echo\ \$II\ \|\ sed\ -ne\
>
\"s/\^\[\^-\]\\+-\\\(\[0-9\]\\\{8\\\}\\\)\\.\\\(\[0-9\]\\\{2\\\}\\\)\\\(\[0-9\]\\\{2\\\}\\\)\\\(\[0-9\]\\\{2\\\}\\\)-$hostname\$/\\1\
> \\2:\\3:\\4/p\"\)\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$DATE\"\ -a\ \$\(date\ -d\ \"\$DATE\"\
> +%s\)\ -lt\ \$AGE\ \]\ \;\ then\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\ \$II\)\"\
> \ \ \ \ \ \ DRIVE=\$\{SHADOWLINK##\*\\\\\}\;\ DRIVE=\$\{DRIVE%%-\*\}\;\
> DRIVE=\"\$\{DRIVE\^\^\}:\"\
> \ \ \ \ \ \ SHADOWPATH=\$\(fsutil\ reparsepoint\ query\ \$SHADOWLINK\
> \|\ sed\ -ne\ \"s\|\^Print\
> Name:\[\[:space:\]\]\*\\\(.\*\\\)\\\\\\\\\\r\|\\1\|p\"\)\
> \ \ \ \ \ \ SHADOWID=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> path=\$\{SHADOWPATH//\\\\/\\\\\\\\\}\ \'path\ ==\ \$3\ \{print\ \$8\}\'\)\"\
> \ \ \ \ \ \ echo\ \"\ \ \ Deleting\ shadow\ for\ \'\$DRIVE\'\
> PATH=\$SHADOWPATH\;\ ID=\$SHADOWID\;\ LINK=\$SHADOWLINK\"\
> \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\ /quiet\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ shadow\ copy\
> for\ \'\$DRIVE\':\ \$SHADOWLINK\"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ link\ for\
> \'\$DRIVE\':\ \$SHADOWLINK\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ done\
> \ \ \ \ \ \ function\ errortrap\ \ \{\ \
> \ \ \ \ \ \ \ \ echo\ \"ERROR\ setting\ up\ shadows...\"\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$SHADOWID\"\ \]\;\ then\
> \ \ \ \ \ \ \ \ \ \ unset\ ERROR\
> \ \ \ \ \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\
> /quiet\ \|\|\ ERROR=\"ERROR\ \"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ \ \ echo\ \"\ \ \ \$\{ERROR\}Deleting\ shadow\ copy\
> for\ \'\$\{I\^\^\}:\'\ \$SHADOWID\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ \ \ if\ \[\ -n\ \"\$SHADOWLINK\"\ \]\;\ then\
> \ \ \ \ \ \ \ \ \ \ unset\ ERROR\
> \ \ \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ ERROR=\"ERROR\ \"\
> \ \ \ \ \ \ \ \ \ \ echo\ \"\ \ \ \$\{ERROR\}Deleting\ shadow\ link\
> for\ \'\$\{I\^\^\}:\'\ \$SHADOWLINK\"\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ for\ II\ in\ \$\(\\ls\ -d\ ${shadowdir}\*-${hosttimestamp}\
> 2\>/dev/null\)\;\ do\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\ \$II\)\"\
> \ \ \ \ \ \ DRIVE=\$\{SHADOWLINK##\*\\\\\}\;\ DRIVE=\$\{DRIVE%%-\*\}\;\
> DRIVE=\"\$\{DRIVE\^\^\}:\"\
> \ \ \ \ \ \ SHADOWPATH=\$\(fsutil\ reparsepoint\ query\ \$SHADOWLINK\
> \|\ sed\ -ne\ \"s\|\^Print\
> Name:\[\[:space:\]\]\*\\\(.\*\\\)\\\\\\\\\\r\|\\1\|p\"\)\
> \ \ \ \ \ \ SHADOWID=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> path=\$\{SHADOWPATH//\\\\/\\\\\\\\\}\ \'path\ ==\ \$3\ \{print\ \$8\}\'\)\"\
> \ \ \ \ \ \ echo\ \"\ \ \ Deleting\ shadow\ for\ \'\$DRIVE\'\
> PATH=\$SHADOWPATH\;\ ID=\$SHADOWID\;\ LINK=\$SHADOWLINK\"\
> \ \ \ \ \ \ \(vssadmin\ delete\ shadows\ /shadow=\$SHADOWID\ /quiet\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ shadow\ copy\
> for\ \'\$DRIVE\':\ \$SHADOWLINK\"\)\ \|\ tail\ +4\
> \ \ \ \ \ \ \ \ cmd\ /c\ rmdir\ \$SHADOWLINK\ \|\|\ \
> \ \ \ \ \ \ \ \ echo\ \"\ \ \ ERROR:\ Couldn\'t\ delete\ link\ for\
> \'\$DRIVE\':\ \$SHADOWLINK\"\
> \ \ \ \ \ \ done\
> \ \ \ \ \ \ \ \ exit\ 1\ \
> \ \ \ \ \ \ \}\
> \ \ \ \ \ \ trap\ errortrap\ ERR\
> \ \ \ \ \ \ \[\ -n\ \"$shadows\"\ \]\ \&\&\ mkdir\ -p\ $shadowdir\
> \ \ \ \ \ \ for\ I\ in\ $shadows\;\ do\
> \ \ \ \ \ \ \ \ if\ !\ \[\ -d\ \"\$\(cygpath\ -u\ \$\{I\}:\)\"\ \]\
> \|\|\ !\ grep\ -qE\ \"\^\$\{I\^\^\}:\ \\S+\ ntfs\ \"\ \<\(mount\ -m\)\;\
> then\
> \ \ \ \ \ \ \ \ \ \ echo\ \"No\ such\ NTFS\ drive\ \'\$\{I\}:\'\
> skipping\ corresponding\ shadow\ setup...\"\
> \ \ \ \ \ \ \ \ \ \ continue\
> \ \ \ \ \ \ \ \ fi\
> \ \ \ \ \ \ \{\ SHADOWID=\"\$\(wmic\ shadowcopy\ call\ create\
> Volume=\$\{I\}:\\\\\ \|\ sed\ -ne\ \'s\|\[\ \\t\]\*ShadowID\ =\
> \"\\\(\[\^\"\]\*\\\).\*\|\\1\|p\'\)\"\ \;\ \}\ 2\>\ \>\(tail\ +2\)\
> \ \ \ \ \ \ SHADOWPATH=\"\$\(wmic\ shadowcopy\ \|\ awk\ -v\
> id=\$SHADOWID\ \'id\ ==\ \$8\ \{print\ \$3\}\'\)\"\
> \ \ \ \ \ \ SHADOWLINK=\"\$\(cygpath\ -w\
> ${shadowdir}\)\$I-$hosttimestamp\"\
> \ \ \ \ \ \ cmd\ /c\ \"mklink\ /j\ \$SHADOWLINK\ \$SHADOWPATH\\\\\"\
> \ \ \ \ \ \ unset\ SHADOWID\ SHADOWPATH\ SHADOWLINK\
> \ \ \ \ \ \ done\
> ";
> #Run script $bashscript on remote host via ssh
> open(my $out_fh, "|-", "/usr/bin/ssh -q -x -i
> /var/lib/backuppc/.ssh/id_rsa -l BackupPC $args[0]->{hostIP} bash -s")
> or warn "Can't start ssh: $!";
> print $out_fh "$bashscript";
> close $out_fh or warn "Error flushing/closing pipe to ssh: $!";
> ;
>
> my $sharenameref=$bpc->{Conf}{ClientShareName2Path};
> foreach my $key (keys %{$sharenameref}) { #Rewrite
> ClientShareName2Path
> $sharenameref->{$key} = "$shadowdir$2-$hosttimestamp$3" if
> $sharenameref->{$key} =~
> m#^(/cygdrive)?/([a-zA-Z])(/.*)?$#; #Add shadow if letter drive
> }
> print map { " '$_' => $sharenameref->{$_}
> " } sort(keys %{$sharenameref}) unless $?;
> }}
> No such NTFS drive 'C:' skipping corresponding shadow setup...
> 'C' => /cygdrive/c/shadow/C-20210227.003013-keep
> Eval return value: 1
> __bpc_progress_state__ backup share "C"
> Running: /usr/local/bin/rsync_bpc --bpc-top-dir /var/lib/backuppc
> --bpc-host-name hostvm2 --bpc-share-name C --bpc-bkup-num 1
> --bpc-bkup-comp 3 --bpc-bkup-prevnum -1 --bpc-bkup-prevcomp -1
> --bpc-bkup-inode0 608082 --bpc-log-level 1 --bpc-attrib-new -e
> /usr/bin/ssh\ -l\ BackupPC
> --rsync-path=/cygdrive/c/cygwin64/root/bin/rsync.exe --super --recursive
> --protect-args --numeric-ids --perms --owner --group -D --times --links
> --hard-links --delete --partial --log-format=log:\ %o\ %i\ %B\ %8U,%8G\
> %9l\ %f%L --stats --checksum --one-file-system --timeout=72000
> 10.1.1.119:/cygdrive/c/shadow/C-20210227.003013-keep/ /
> full backup started for directory C (client path
> /cygdrive/c/shadow/C-20210227.003013-keep)
> started full dump, share=C
> Xfer PIDs are now 4016
> xferPids 4016
> This is the rsync child about to exec /usr/local/bin/rsync_bpc
> cmdExecOrEval: about to exec /usr/local/bin/rsync_bpc --bpc-top-dir
> /var/lib/backuppc --bpc-host-name hostvm2 --bpc-share-name C
> --bpc-bkup-num 1 --bpc-bkup-comp 3 --bpc-bkup-prevnum -1
> --bpc-bkup-prevcomp -1 --bpc-bkup-inode0 608082 --bpc-log-level 1
> --bpc-attrib-new -e /usr/bin/ssh\ -l\ BackupPC
> --rsync-path=/cygdrive/c/cygwin64/root/bin/rsync.exe --super --recursive
> --protect-args --numeric-ids --perms --owner --group -D --times --links
> --hard-links --delete --partial --log-format=log:\ %o\ %i\ %B\ %8U,%8G\
> %9l\ %f%L --stats --checksum --one-file-system --timeout=72000
> 10.1.1.119:/cygdrive/c/shadow/C-20210227.003013-keep/ /
> rsync: [sender] change_dir "/cygdrive/c/shadow/C-20210227.003013-keep"
> failed: No such file or directory (2)
>
>
>
>
> > Adam Goryachev via BackupPC-users wrote at about 17:04:21 +1100 on
Friday, February 26, 2021:
> > > Hi,
> > >
> > > I've just setup a new Win10 machine, and thought I'd try this solution
> > > to do the backup...
> > >
> > > So far, I have installed the MS SSH server, using the powershell
command
> > > line installation method, copied the backuppc ssh public key across,
> > > used a powershell script to fix permissions on the file. Confirmed I
> > > could login from the backuppc host as a new backuppc user
> > > (administrative access).
> > >
> > > I then downloaded cygwin, ran the setup, and installed rsync plus all
> > > other defaults (did not install SSH).
> > >
> > > I then changed the default SSH shell to bash instead of powershell
> > > (registry key).
> > >
> > > Fixed the PATH variable in the .bashrc to ensure cygwin's /bin was
included
> > >
> > > Copied the below script to my new hosts.pl config file, along with the
> > > following host specific config:
> > >
> > > $Conf{ClientNameAlias} = [
> > > '10.1.1.119'
> > > ];
> > > $Conf{XferMethod} = 'rsync';
> > > $Conf{RsyncdUserName} = 'BackupPC';
> > > $Conf{RsyncShareName} = [
> > > '/cygdrive/C/'
> > > ];
> > > $Conf{RsyncSshArgs} = [
> > > '-e',
> > > '$sshPath -l BackupPC'
> > > ];
> > > $Conf{RsyncClientPath} = '/cygdrive/c/cygwin64/root/bin/rsync.exe';
> > > $Conf{PingMaxMsec} = 100;
> > > $Conf{BlackoutPeriods} = [];
> > >
> > > However, when I try to run the backup, I get the following:
> > >
> > > Executing DumpPreUserCmd: &{sub {
> > > #Load variables
> > > my $timestamp = "20210226-012400";
> > > my $shadowdir = "/cygdrive/c/shadow/";
> > > my $shadows = "";
> > >
> > > my $bashscript = "DAYS=2\
> > >
> > > etc (cut)
> > >
> > > print map { " '$_' => $sharenameref->{$_}
> > > " } sort(keys %{$sharenameref}) unless $?;
> > > }}
> > > Eval return value: 1
> > > Running: /usr/local/bin/rsync_bpc --bpc-top-dir /var/lib/backuppc
--bpc-host-name hostvm2 --bpc-share-name /cygdrive/C/ --bpc-bkup-num 0 --bpc-bkup-comp 3
--bpc-bkup-prevnum -1 --bpc-bkup-prevcomp -1 --bpc-bkup-inode0 5 --bpc-log-level 1
--bpc-attrib-new -e /usr/bin/ssh\ -l\ BackupPC
--rsync-path=/cygdrive/c/cygwin64/root/bin/rsync.exe --super --recursive --protect-args
--numeric-ids --perms --owner --group -D --times --links --hard-links --delete --partial
--log-format=log:\ %o\ %i\ %B\ %8U,%8G\ %9l\ %f%L --stats --checksum --one-file-system
--timeout=72000 10.1.1.119:/cygdrive/C/ /
> > > full backup started for directory /cygdrive/C/
> > > Xfer PIDs are now 31043
> > > This is the rsync child about to exec /usr/local/bin/rsync_bpc
> > > cmdExecOrEval: about to exec /usr/local/bin/rsync_bpc --bpc-top-dir
/var/lib/backuppc --bpc-host-name hostvm2 --bpc-share-name /cygdrive/C/ --bpc-bkup-num 0
--bpc-bkup-comp 3 --bpc-bkup-prevnum -1 --bpc-bkup-prevcomp -1 --bpc-bkup-inode0 5
--bpc-log-level 1 --bpc-attrib-new -e /usr/bin/ssh\ -l\ BackupPC
--rsync-path=/cygdrive/c/cygwin64/root/bin/rsync.exe --super --recursive --protect-args
--numeric-ids --perms --owner --group -D --times --links --hard-links --delete --partial
--log-format=log:\ %o\ %i\ %B\ %8U,%8G\ %9l\ %f%L --stats --checksum --one-file-system
--timeout=72000 10.1.1.119:/cygdrive/C/ /
> > > Xfer PIDs are now 31043,31172
> > > xferPids 31043,31172
> > > rsync: [sender] send_files failed to open
"/cygdrive/C/DumpStack.log.tmp": Device or resource busy (16)
> > > new recv cd+++++++++ ---r-x--- 328384, 328384 0 .
> > > rsync: [sender] send_files failed to open "/cygdrive/C/hiberfil.sys":
Device or resource busy (16)
> > > rsync: [sender] send_files failed to open "/cygdrive/C/pagefile.sys":
Device or resource busy (16)
> > > rsync: [sender] send_files failed to open "/cygdrive/C/swapfile.sys":
Device or resource busy (16)
> > >
> > >
> > > As far as I can tell, this would suggest that we are not actually
doing
> > > the backup from the shadow copy... so, good news, I got a full backup
of
> > > the machine (excluding open files), but bad news is I don't know why
it
> > > didn't work.
> > >
> > > I can login from the backuppc host as the backuppc user on the windows
> > > machine, and I can then create a shadow volume and delete it, but not
> > > sure what else to test, or where to get additional logs from....
> > >
> > > Any suggestions greatly appreciated
> > >
> > > Regards,
> > > Adam
> > >
> > > On 26/2/21 07:31, Greg Harris wrote:
> > > > Okay, I was just making things way harder than they needed to be.
> > > > Sorry Jeff. Doug, from my understanding DeltaCopy is nearly just
an
> > > > alternative version of cygwin-rsyncd. I think all you need to do is
> > > > dump these scripts into the bottom of the .pl file for the host.
> > > > Otherwise, all of the other setup you normally do should be the
same.
> > > >
> > > > Thanks,
> > > >
> > > > Greg Harris
> > > >
> > > >> On Feb 23, 2021, at 10:58 AM, backu...@kosowsky.org
> > > >> <mailto:backu...@kosowsky.org> wrote:
> > > >>
> > > >> Yes. SSH needs to be minimally configured just as you do when using
> > > >> the 'rsync' method (over ssh) for any other system.
> > > >>
> > > >> And SSH is pretty basic for any type of communication, login, file
> > > >> transfer between machines in the 20th century (with the exception
> > > >> maybe of pure Windows environments)
> > > >>
> > > >> Technically, SSH may not be a dependency for rsync in that you can
> > > >> use 'rsyncd' without SSH but the vast majority of rsync usage
between
> > > >> local and remote machines (with or without backuppc) is over ssh.
> > > >>
> > > >> Greg Harris wrote at about 15:51:26 +0000 on Tuesday, February 23,
2021:
> > > >>> I was hoping that I could reply with at least a basic outline.
> > > >>> However, I’m still trying to figure out what I’m missing.
> > > >>>
> > > >>> Jeff, you seem to imply that there’s no client side config that
> > > >>> needs to be done? When I installed SSH via the base CygWin, it
> > > >>> seems like there is at least basic setup steps to getting sshd
> > > >>> running. Maybe you are considering those basic install pieces?
> > > >>> Sorry I’m such a newb on this, but I’m wading my way through and
> > > >>> feeling a bit tripped up as I try to do the minimum possible to
> > > >>> maximize the usage.
> > > >>>
> > > >>> Additionally, it seems that openssh is not a dependency for rsycn
in
> > > >>> Cygwin, so I had to specify both separately.
> > > >>>
> > > >>> I get the feeling that what I was expecting to do is a hybrid of
> > > >>> using the BackupPC Cygwin install on the client and then this
script
> > > >>> on the server side, rather than configuring anything on either
side.
> > > >>> Maybe my expectations are wildly off.
> > > >>>
> > > >>> Thanks,
> > > >>>
> > > >>> Greg Harris
> > > >>>
> > > >>> On Feb 18, 2021, at 9:30 AM, Doug Lytle <supp...@drdos.info
> > > >>> <mailto:supp...@drdos.info><mailto:supp...@drdos.info
> > > >>> <mailto:supp...@drdos.info>>> wrote:
> > > >>>
> > > >>> 'cygpath' is part of the basic 'cygwin' package.
> > > >>>
> > > >>> Okay,
> > > >>>
> > > >>> For someone that has always used DeltaCopy on the clients, is
there
> > > >>> a step-by-step instruction page that explains on how to use this?
> > > >>>
> > > >>> Thanks!
> > > >>>
> > > >>> Doug
> > > >>>
> > > >>>
> > > >>> _______________________________________________
> > > >>> BackupPC-users mailing list
> > > >>> BackupPC-users@lists.sourceforge.net
> > > >>>
<mailto:BackupPC-users@lists.sourceforge.net><mailto:BackupPC-users@lists.sourceforge.net
> > > >>> <mailto:BackupPC-users@lists.sourceforge.net>>
> > > >>> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > > >>> <https://lists.sourceforge.net/lists/listinfo/backuppc-users>
> > > >>> Wiki: https://github.com/backuppc/backuppc/wiki
> > > >>> <https://github.com/backuppc/backuppc/wiki>
> > > >>> Project: https://backuppc.github.io/backuppc/
> > > >>> <https://backuppc.github.io/backuppc/>
> > > >>>
> > > >>> _______________________________________________
> > > >>> BackupPC-users mailing list
> > > >>> BackupPC-users@lists.sourceforge.net
> > > >>> <mailto:BackupPC-users@lists.sourceforge.net>
> > > >>> List:
https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > > >>> Wiki: https://github.com/backuppc/backuppc/wiki
> > > >>> Project: https://backuppc.github.io/backuppc/
> > > >>
> > > >>
> > > >>
> > > >> _______________________________________________
> > > >> BackupPC-users mailing list
> > > >> BackupPC-users@lists.sourceforge.net
> > > >> <mailto:BackupPC-users@lists.sourceforge.net>
> > > >> List:
https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > > >> Wiki: https://github.com/backuppc/backuppc/wiki
> > > >> Project: https://backuppc.github.io/backuppc/
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > BackupPC-users mailing list
> > > > BackupPC-users@lists.sourceforge.net
> > > > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > > > Wiki: https://github.com/backuppc/backuppc/wiki
> > > > Project: https://backuppc.github.io/backuppc/
> > > _______________________________________________
> > > BackupPC-users mailing list
> > > BackupPC-users@lists.sourceforge.net
> > > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > > Wiki: https://github.com/backuppc/backuppc/wiki
> > > Project: https://backuppc.github.io/backuppc/
> >
> >
> > _______________________________________________
> > BackupPC-users mailing list
> > BackupPC-users@lists.sourceforge.net
> > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> > Wiki: https://github.com/backuppc/backuppc/wiki
> > Project: https://backuppc.github.io/backuppc/
>
>
> _______________________________________________
> BackupPC-users mailing list
> BackupPC-users@lists.sourceforge.net
> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
> Wiki: https://github.com/backuppc/backuppc/wiki
> Project: https://backuppc.github.io/backuppc/
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/