DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 9th February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,156
Thanked 182 Times in 149 Posts
Default Easily retrievable configuration file backup with Gmail

Shortly after I accepted an invitation for a Gmail account, (thank you Joost), I found it very easy to send configuration files to my account.

A simple command from the command line to mail me a backup of my pf.conf file:

Code:
# mail -s 'Parmenides: pf.conf' g.w.bush@gmail.com </etc/pf.conf
I created a label BAK to archive these configuration backup mails and some time later I found an easy way to automatically apply this BAK label.

There are two requirements:
  1. Upon mailing, append a plus sign followed by the label to the 'TO: address'.

    So instead of just using g.w.bush@gmail.com use g.w.bush+BAK@gmail.com.

    Example:
    Code:
    $ mail -s 'Hercules: xorg.conf' g.w.bush+BAK@gmail.com </etc/XII/xorg.conf
  2. Create a Gmail filter to automatically apply a Gmail label

    In the 'Create Filter' dialogue box, enter +BAK in the To: field.
    After clicking 'Next step' you will see something like this:

    Code:
    Choose action - Now, select the action you'd like to take on messages
    that match the criteria you specified.
    When a message arrives that matches the search: to:(+BAK), do the following:
    
    [ ] Skip the Inbox (Archive it)
    [ ] Mark as read
    [ ] Star it
    [ ] Apply the label:   
    [ ] Forward it to:
    [ ] Delete it
    [ ] Never send it to Spam
    Check 'Apply the label'. You can either use an existing label or create a new one, which even doesn't have to be BAK.
    Also select 'Never send it to Spam' to eliminate the chance you backup ends up there, and gets deleted after 30 days.

    After you have finished the last filter creation steps, you are ready to use this easy way of creating backups of all your carefully handcrafted configuration files.

Real life example

Yesterday the following BAK mail saved me a lot of trouble when I installed a new OpenBSD snapshot, and wanted to preserve my original disklabel layout:

Code:
Charlie Root             to me show details Jan 17
	
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a     61.4M   32.0M   26.3M    55%    /
/dev/wd0m      6.5G    2.8G    3.4G    44%    /backup
/dev/wd0e     19.7G    2.8G   15.9G    15%    /home/j65nko
/dev/wd0d      502M    2.0K    477M     0%    /tmp
/dev/wd0k      3.9G    418M    3.3G    11%    /usr
/dev/wd0l      3.9G    210K    3.7G     0%    /usr/local
/dev/wd0f     1005M    3.0M    952M     0%    /var
/dev/wd0h      502M    122K    477M     0%    /var/log
/dev/wd0g      502M    4.0K    477M     0%    /var/tmp
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 9th February 2010 at 04:19 AM. Reason: Changed pietjepuk to g.w.bush as the example gmail account
Reply With Quote
  #2   (View Single Post)  
Old 9th February 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts
Default

It's been possible to sign up on your own for some time now, no invitation required.

Perhaps I'm slow, but is 'pietjepuk' your or someone elses email? If not.. I don't get the reference.
Reply With Quote
  #3   (View Single Post)  
Old 9th February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,156
Thanked 182 Times in 149 Posts
Default

"Pietje Puk" is the Dutch equivalent of John Doe. I just changed it to "g.w.bush' your favorite politician.

BTW "g.w.bush' is an invalid gmail account because gmail only allows one period in the account name, which is discriminates Dutch, Flemish and German nationals.
People from these countries would like to use names like 'don.van.vliet', 'piet.van.geraertsberghen" and 'herbert.von.karajan' but gmail does not allow it.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 9th February 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts
Default

But I'm Canadian!

Also, they allow hyphens and underscores in place of periods.. so I guess that's something.
Reply With Quote
  #5   (View Single Post)  
Old 10th February 2010
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 566
Thanked 14 Times in 13 Posts
Default

Now I'm wondering if the Canadian translation of "Pietje Puk" is Peter Puck ?
Reply With Quote
  #6   (View Single Post)  
Old 10th February 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts
Default

No, AFAIK we use the John & Jane Doe analogy.
Reply With Quote
Reply

Tags
backup

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking your sed(1) skills beyond the easily swallowed 's/x/y/' porridge J65nko Guides 5 3rd February 2010 08:23 PM
PHP read file contents - Maximum file size cksraj Programming 1 21st September 2009 11:38 AM
backup freeBSD 7.0 using Backup Exec ccc FreeBSD General 2 25th April 2009 09:23 PM
backup drive to image file milo974 OpenBSD General 8 14th August 2008 02:01 PM
Kernel configuration file ignored? FWS FreeBSD Installation and Upgrading 16 26th June 2008 10:28 AM


All times are GMT. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick