change md file

This commit is contained in:
Marko Oldenburg 2019-02-19 14:18:09 +01:00
parent 14d2bdb63f
commit 67a16b51a4
3 changed files with 20 additions and 14 deletions

View File

@ -4,11 +4,17 @@
backupME.pl backupME.conf
```
Es ist möglich mehrere Konfigurationsdateien an zu legen und diese dann immer entsprechend zu übergeben.
Es ist möglich mehrere Konfigurationsdateien an zu legen und backupME zu übergeben.
```
/usr/local/bin/backupME.pl /usr/local/etc/backupME_FHEM.conf
/usr/local/bin/backupME.pl -c /usr/local/etc/backupME_FHEM.conf
/usr/local/bin/backupME.pl /usr/local/etc/backupME_DOKUWIKI.conf
/usr/local/bin/backupME.pl --configs /usr/local/etc/backupME_DOKUWIKI.conf
/usr/local/bin/backupME.pl -c /usr/local/etc/backupME_FHEM.conf,/usr/local/etc/backupME_DOKUWIKI.conf
/usr/local/bin/backupME.pl --configs /usr/local/etc/backupME_FHEM.conf,/usr/local/etc/backupME_DOKUWIKI.conf
/usr/local/bin/backupME.pl --configfiles /usr/local/etc/backupME_FHEM.conf,/usr/local/etc/backupME_DOKUWIKI.conf
```
### Konfiguration

View File

@ -12,7 +12,7 @@ SOURCEPATH=/opt/fhem/backup
FILES_TO_BACKUP=FHEM-"`date +%Y%m%d`"*.tar.gz
# Verzeichnis unter welches die Backupstruktur aufgebaut werden soll.
BACKUPPATH=/home/marko/Google_Drive_Secure/pi-webapp01_BACKUPS
BACKUPPATH=/home/marko/tmp/webapps
# wie viele Backups sollen aufgehoben werden.
DAILY_DATA_BACKUPS=6

View File

@ -117,7 +117,10 @@ sub MainBackup {
$fnState = createDBdump() if ( $self->{config}->{MYSQLDUMP} and not $fnState );
$fnState = runBackup(( (split(" ", localtime(time)))[0] =~ /^(Sun)$/ ? 'archive' : 'daily' )) unless ($fnState);
sendStateToFHEM( ($fnState ? 'error' : 'ok') ) if ( $self->{config}->{FHEMSUPPORT} );
if ( $self->{config}->{FHEMSUPPORT} ) {
logMessage(3,'can\'t connect to FHEM Instance')
unless ( sendStateToFHEM(($fnState ? 'error' : 'ok')) );
}
MainBackup if( scalar(@{$self->{configfiles}}) > 0 );
}
@ -254,12 +257,8 @@ sub readConfigFile {
sub parseOptions {
my $conffiles = undef;
## Aufruf
# --configfiles <filenames>
# -config
GetOptions(
'configfiles|configs|c=s' => \$conffiles,
'configfiles|configs|c=s' => \$conffiles,
) or usageExit;
usageExit unless ( defined($conffiles) );
@ -278,9 +277,9 @@ sub usageExit {
sub logMessage($$) {
my ($level,$text) = @_;
my %levels = ( 1 => "\t\tInfo - ",
my %levels = ( 1 => 'Info - ',
2 => "\tWarning - ",
3 => 'ERROR!!! - ',
3 => "\t\tERROR!!! - ",
);
print($levels{$level} . $text . "\n");
@ -328,11 +327,12 @@ sub sendStateToFHEM($) {
my $HOSTNAME = "127.0.0.1";
my $HOSTPORT = "7072";
my $socket = IO::Socket::INET->new('PeerAddr' => $HOSTNAME,'PeerPort' => $HOSTPORT,'Proto' => 'tcp')
or return 'can\'t connect to FHEM Instance';
or return 0;
print $socket 'setreading ' . $self->{config}->{FHEMDUMMY} . ' state ' . $bckState ."\n";
print $socket 'setreading ' . $self->{config}->{FHEMDUMMY} . ' dbBackup ' . ($self->{config}->{MYSQLDUMP} ? 'yes' : 'no') ."\n";
print $socket 'setreading ' . $self->{config}->{FHEMDUMMY} . ' cleanUpSourcePath ' . ((defined($self->{config}->{CLEAN_UP_PATHS}) and $self->{config}->{CLEAN_UP_PATHS}) ? 'yes' : 'no') ."\n";
$socket->close;
return 1;
}