Hello :) It`s my first attempt to learn perl. Until now I`ve preferred to write scripts in bash but they are not much flexible as i think perl can be. First things you should know - this script isn`t complete yet. Some of defined variables are not used yet. Issue coresponds to foreach loops. First one foreach reads filenames with correct extension defined in $bazaroz and put all of those filenames in table @files. Second foreach should for all files listed in @files perform operation defined in line 35 - system('./gbak.... When I launch this part of script which IMHO should work perl throws out:
./backup.pl Search pattern not terminated at ./backup.pl line 35.
Can you please explain me about what search pattern it says? whole script below:
#!/usr/bin/perl -w my $fbbin = "/opt/firebird/bin"; my $bazy = "/opt/databases"; my $bazaroz = "gdb"; my $shared = "/opt/shared"; my $kopie = "/home/mery/backup/temp"; my $kopietar = "/home/mery/backup/complete"; my $usbdev = "/dev/sdc1/"; my $localdir = "/mnt/storage/testy"; my $mailerr = "core-powiadomienia\@core.com.pl"; my $klient = "PanTester"; my $mailtopic = "Raport nocnej kopii zapasowe w firmie $klient"; #date settings my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(t +ime); my $ymd = sprintf("%04d-%02d-%02d-%02d-%02d-%02d",$year+1900,$mon,$mda +y,$hour,$min,$sec); my $type = $bazaroz; my $dir = $bazy; $type = "*.$type"; print "Szukam plikow z rozszerzeniem $type \n"; chdir ($dir); @files = qx(ls $type 2>&1); foreach (@files) { print "Baza: $_\n"; } #Backup foreach (@files) { system('cd $fbbin); print "Tworze kopie bazy $baza \n"; system('./gbak -user sysdba -password masterkey -BACKUP_DATABA +SE localhost:$bazy\/$_ $kopie\/$_.gbk') or print "Blad archiwizowania + bazy $baza \n"; print "Gotowa kopia bazy $baza \n"; } print "Koniec archiwizacji baz w firmie $klient w dniu $ymd \n";

In reply to Firebird databases backup script by Mery84

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.