Solved

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

Posted on 2013-01-10
5
1,090 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 23

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 23

Author Closing Comment

by:Mohammed Hamada
ID: 38816018
thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now