Solved

Synchronize then delete remote directory using SSH-SFTP program or Linux (Centos) command lines

Posted on 2013-01-10
5
1,107 Views
Last Modified: 2013-01-24
Hello Experts,

I have a PBX system which has very limited capacity for call recording that will not last for more than a week probably.

I'm using WinSCP through SFTP (SSH Based on port 22) at the moment to sync remote folder to my PC,  but I have to do this manually each week to sync the recording folder, then delete its remote contents so the PBX can start recording again.

I would like to know if there's any other application that would schedule Synchronization through SSH - SFTP and then delete the remote directory contents. and incase there's not. is there anyway to do this through Centos command lines? as The PBX has also support to USB external storage and I would also be glad if I could schedule moving the recording folder contents from a directory path into another.

Thanks a lot



Thanks
0
Comment
Question by:Mohammed Hamada
  • 2
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 38763097
you can run a crontab job to copy then truncate the file

/usr/bin/cp /path/to/yourfile /path/to/somedir/filename
> /path/to/yourfile

put above two lines in a file, say myscript

make it executable

chmod +x myscript

then run

crontab > mycron

echo '59 23 * * * /path/to/myscript' >> mycron

crontab mycron
0
 
LVL 24

Author Comment

by:Mohammed Hamada
ID: 38763363
Salam Omar,

Would this allow the executable script file to be scheduled for weekly run?
thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 38763387
you can change the last * into the day of week you want like


59 23 * * 0 /path/to/myscript

here 0 is for Sunday or you can put 1 for Monday, 2 for Tue etc.
0
 
LVL 16

Assisted Solution

by:AlexPace
AlexPace earned 250 total points
ID: 38763994
You could use a Robo-FTP script installed as a service to just download the files as they appear on the remote site.  See: http://kb.robo-ftp.com/script_library/show/69
0
 
LVL 24

Author Closing Comment

by:Mohammed Hamada
ID: 38816018
thanks
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know how boring and exhausting it is to transfer huge web projects developed locally to a webserver simply via FTP. The File Transfer Protocol is a really nice solution if you need to transfer small amounts of files, but if you're plannin…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question