crontab; copy most recent *.mpg file from local machine to smb storage device
Hello,
I've been searching your forum for an answer to the following question and whilst I've seen several which may help I'm afraid my inexperience with UNIX systems has got the better of me and I'm incapable of piecing your considerable expertise together.
Problem:
I have a linux box which creates video files hourly, I need to backup these files once they are created to a network share accesible via smb - the files are date stamped; YYYYMMDDHH.mpg
Limitations:
I cannot amend or interface with the encoding process. I cannot seem to write a script which moves the local file/s/folder to the remote share.
Could I write a script which CRONTAB could run each hour that copied the entire folder to the destination directory? Is there any way in which I can chose to not backup the entire folder but instead, only the latest addition/s to the local folder?
Please state what Operating System you have and which is your preferred shell.
Are the files created in a predicatable manner such that the required cron can run on files which are definitely complete?
It is quite easy if there is a quiet slot when no files can be created.
My first thought is to create a script which copies the files during a quiet time slot, then immediately create a reference file with "touch". After the first instance, use "find -newer" relative to the reference file and re-touch the reference file after the copy. This technique will not work unless there is a regular quiet time slot.
Last edited by methyl; 05-24-2009 at 06:07 PM..
Reason: afterthought
I'm using Red Hat 5, as for my preferred shell; I have none, I'm afraid I'm ignorant and this is my first venture into shell scripting - bash if at all possible. Running this series of commands using CRON?
The video encoding process runs from 00-58minutes passed each hour. There is therefore a two minute window each hour where all the system is doing is writing the file it's just created.
Thanks for your continued patience with my lack of knowledge,
I've made a little progress, I'm comfortable with calling scripts I create using CRONTAB. I haven't used your touch method, I've been slightly free-wheeling... Whilst the below method isn't the most inspired, it will also mean that I won't backup any sections of video that failed to encode for the full 58minutes. This is a bonus if I specify that CRONTAB run an amended flavour of this script in the 2minute downtime - this is actually beneficial as clips <58minutes would be of little use.
I've gone for using the -mmin command within find which should allow me to find files modofied with X minutes of the current time. Whilst this is not bomb-proof, I know that the other contents of the source folder won't be amended...
I'm finding that the results of my find query return the folder location ./ and therefore experimented with removing this using the sed command and failed, despite trawling through forum after forum which detail that escaping the / should be easy, I can't seem to do this.
Criticism welcome, I'd appreciate any pointers -
Thanks again.
Last edited by vbe; 05-27-2009 at 05:07 AM..
Reason: removed URL
Very new to shell scripting. Not sure if my title is correct but I will try and explain.
Directory has 100+ files with this format, " ABCD_ABC_Abc_AB0126.abc ". When a new file gets created, the 16-19 characters in the file name gets incremented by 1. Ex...todays most recent file is... (14 Replies)
Team,
Presently i am running a script from my local box(i.e jumpbox) to all the remote machines.Basically fetching basic queries like pwd,mkdir,touch etc and i am able to successfully fetch it from my local machine.But when i want to check certain database related queries like the dbstat... (20 Replies)
I want to SSH to 192.168.1.15 Server from my machine, my ip was 192.168.1.99
Source Destination was UP, with IP 192.168.1.15.
This is LAN Network there are 30 Machine's Connected to the network and working fine, I'm Playing around the local machine's because I need to apply the same rules in... (2 Replies)
Hello,
I need to create a shell script which will copy files - which are created on particular date and starting with particular name - to local windows XP machine.
Is this possible.?
Currently it is being done manually using winscp (1 Reply)
Hi Am using unix Ksh
Am getting the problem while transferring zero size files through the script .
When i transfer zero size files from local machine to remote machine manually i can able to do it .
My question its beause of zero size files am not able to transfer through script ? or its... (2 Replies)
Hi All..
Am new to Unix!!
Am creating a shell script in which a scenario is like i have transfer the output file from unix machine (Server) to local directory (Windows xp).
And also i have to transfer the input file from the local directory to Unix machine (Server)
Any help from you... (1 Reply)
Hi All,
URGENT - Please help me form a scipt for this:
I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server)
I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
I am logged into a server via SSH.
There is a file on my desktop of my Windows PC I would like to put on that server.
How do I do it?
SCP looks the likely method but how does the server know where the file is on the local machine?
Thanks. (2 Replies)
i want to run some solaris executable program (text file). i telnet to solaris machine. the text file is on the net drive h: or my local drive on windows system.
how can i copy the text file from local drive in windows to remote machine in solaris system?
thanks. (4 Replies)