Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi ,
I have backed up my clients mailbox /var/spool/mail/client as client1. After i finish re-builing the sendmail config , i want to restore the backed file. But i found that the spooling starts and the new inbox start growing.
Is there a way to overwrite client with client1 without clearing the contents of client.
I mean append client with client1.
if i understand correctly you are trying to append info from client1 to client
not sure how fast and how large your lof file is, but you should be able to do everything through cat and embedding commands, and if log file is not large, then you will not miss any data
cat client1 client >> client3 && mv client client.BACKUP && mv client3 client
you can also do same thing with sed, do man on it for right syntax.
if it is not what you are trying to do please correct me.
Yes you are correct. The purpose is to finally append the files, but as it is a mail box , i don't want mails ton repeat. can you tell me while i append
cat client1 client >> client3 && mv client client.BACKUP && mv client3 client
Shall i get no duplicate mails. I mean during append, i want the contents of files(whichever file it may be) must not be duplicated??
Waiting for your reply??
if both of your mailboxes not containing duplicate information, then you will not receive duplicates, however if they are containing duplicates then you have to filter your mailbox to remove them, also if you are working with a mailbox file it has a From line that is starting a message and each message is separated by a single blank line, once you will cat those 2 files together it is not going to add that line for you, so you will recieve a currupted mailbox file or a message, so before you do that, make sure to add a blank line to the end of a first file, before putting both of the files together. (or you can add a blank line to your sencond message, but it will have to be at the beginning of your spool file) that way you will avoid that curruption.
if you need something to filter your mailbox for a duplicated let me know i think i had a script somewhere that can do that for you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.