Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I would like to scp a file from one linux box to another when the size of the folder changes (up or down). I assume there would be a script involved, but I am not sure a) how I would write the script, and b) how I could get that script to run whenever file size changed (or as frequently as possible scp if the file size has changed)
I can't think of a nice way of doing this. The easy answer is creating a frequent running cron job to ls the file, compare the size to the last ls output, and scp if different.
What is changing your file in the first place? Is it not possible to tag something onto that process to achive your goal? Is the file being changed within unix in the first place, or externally like through a samba share?
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251
Rep:
If I were you I would write a script that backs up that directory or file every day. Keep the directory or file for a cycle of days, for example a 7 day cycle. After the 7 day period you would have another script watching and removing any directory or files older than 7 days, thus keeping you maintenance free and not having to worry about space. Of Course there is one requirement for this and thats usually space, lots of it and that depends on what you are trying to backup. The best part about what you are trying to do is that you have two sources of redundancy, 1 your local server and second where you are scp-ing to! Or at least thats what I read your trying to do..... do I understand your situation right? If so I have several scripts that already do this on our production and development servers, be glad to help!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.