Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
I have a Ubuntu server which I connect to from several Linux boxes, and from Windows subsystem. I have one particular folder that I add to on a regular basis, and back up to an external drive nightly. The script checks the previous backup, and only backs up any changes from the previous night. I then run a script which notifies me by email that the job ran.
I would like to expand upon what I have by checking the size of that folder before and after the backup, and including that info in the email confirmation. I have attached the pertinent cronjob and email script.
Any suggestions would be greatly appreciated. It's okay for now, but it could definitely be improved.
I have a Ubuntu server which I connect to from several Linux boxes, and from Windows subsystem. I have one particular folder that I add to on a regular basis, and back up to an external drive nightly. The script checks the previous backup, and only backs up any changes from the previous night. I then run a script which notifies me by email that the job ran.
I would like to expand upon what I have by checking the size of that folder before and after the backup, and including that info in the email confirmation. I have attached the pertinent cronjob and email script.
Any suggestions would be greatly appreciated. It's okay for now, but it could definitely be improved.
First: Please post code in code tags, not screenshots, when asking for this kind of help.
Second: What have you tried to do what you want to do? How do you 'check the size of a folder'? What would you do to include the results of the check in the email?
Thanks for your input. I included the screenshots because that allowed me to blot out my Gmail user name and password, which is included in my email script.
The email script I am running is one I found by searching the internet. It works for the basic notification, but I'm not proficient enough to edit it to meet my additional needs. At the command prompt, I have used: "du /media/chunkydrew/TranscendBkup/files/andrew/linuxdistros > /Home/size_before" & "/Home/size_after" to pipe the info I want into text files. What I want to do is modify the script to run the du commands before and after the cronjob and incorporate those results into my email results.
That may or may not be possible, but I'm not yet Linux-savvy enough to know how to do it.
Thanks for your input. I included the screenshots because that allowed me to blot out my Gmail user name and password, which is included in my email script.
The email script I am running is one I found by searching the internet. It works for the basic notification, but I'm not proficient enough to edit it to meet my additional needs. At the command prompt, I have used: "du /media/chunkydrew/TranscendBkup/files/andrew/linuxdistros > /Home/size_before" & "/Home/size_after" to pipe the info I want into text files. What I want to do is modify the script to run the du commands before and after the cronjob and incorporate those results into my email results.
That may or may not be possible, but I'm not yet Linux-savvy enough to know how to do it.
If you paste the text, you can change the data you don't want to share.
1. Backup the script
2. Add the du commands where you want them in the script
3. Put the contents of the files into the email, that is, into the MESSAGEBODY variable. See man cat
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.