a quick root crontab is the best solution for making backups. I'm used to tarred files on tape drives- on random access units such as the zip drive, you need to either adopt a naming convention or simply cat to the tar (which is insanely easy with tar) to end up with one file which is most efficient. For a timed daemon, this program is unusually verbose. That's not necessary but for debugging. You might also want to confirm at least the Zip diskette's title before you add files to it, since at 12:00am, you might be writing your english essay when the backup kicks in and deletes it! Because of how tar magic works, you will be able to extract certain sections with no problem, especially if you switch from system() to Archive::Tar which will simplify the interface. The module actually has add_files() and add_data() functions! Also, mounting and unmounting your diskette is not necessary if the drive is all that the backup is used for.

I also noticed that you are not checking for many errors. While you are checking for errors, you will never be notified of such errors if this is a daemon job. if the backup is unsuccessful, I would hope that it would at least mail you or add a syslog(). Also, you will never know when the drive is full. If it is full, it should notify you immediately so that it can continue with the backup.

You should quickly check to see if the diskette is the correct one for backup. Perhaps a small file with the title "Email Backup Disk 1" would do the trick.

In short, daemons should definitely be equipped with an emergency mechanism for failure, such as syslog or wall for more important things.

flock: flock does not implement mandatory locking. If your mail spooler doesn't use flock, then you can't either. If your system supports mandatory file locking, then by all means use it- unless it screws with the spooler....but you're just reading files, whether incomplete or not. A ten second suspension of sendmail is probably out of the question :-) the next backup would catch the next round of data....It's apparent to me that this is not incredibly important so your workarounds would be OK...

AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

In reply to Re: Using perl to automate mail backup by AgentM
in thread Using perl to automate mail backup by zzspectrez

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.