scripted scp when file size changes
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? |
The other way is finding out what has been written for that purpose already.
monit looks like an option: Quote:
I thought cacti or nagios would have support for directory or file size checksums but I could not find that, yet ... Maybe have a look for yourself. Other options might be: - pikt: http://pikt.org/pikt/intro/intro_system_security.html Although it looks like it can only handle files instead of directories. - zabbix: http://www.zabbix.com/ Looks a littlebit too big for this simple purpose. |
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!
|
I am looking at monit, and it looks like it will do the trick.
Thanks for all the help! |
I am looking at monit, and it looks like it will do the trick.
Thanks for all the help! |
All times are GMT -5. The time now is 07:24 PM. |