Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-18-2008, 08:19 PM
|
#1
|
LQ Newbie
Registered: Nov 2008
Posts: 7
Rep:
|
SCP copy file with dynamic date( or something like that)
Ok here is my problem/issue/question that i need some help with.
I am trying to copy a log file that is generated every day. the file will look something like "example.log.20081119.gz", what i want to do is create an scp script/command that will copy this log from a different server.
now because i am starting the connection from a windows box i am using pscp, so far what i have looked at is something like "'pscp -scp -l root -pw ******* draco:/var/log/squid/access.log.'date +"%Y%m%d"'.gz ."
now this does not work.. but i thought it might help you get an idea of what i am trying to do.
i shall endeavor to find the answer but if someone knows how to that would be great.
Thanks.
|
|
|
11-18-2008, 09:06 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,476
|
Quote:
Originally Posted by Shinigami101
Ok here is my problem/issue/question that i need some help with.
I am trying to copy a log file that is generated every day. the file will look something like "example.log.20081119.gz", what i want to do is create an scp script/command that will copy this log from a different server.
now because i am starting the connection from a windows box i am using pscp, so far what i have looked at is something like "'pscp -scp -l root -pw ******* draco:/var/log/squid/access.log.'date +"%Y%m%d"'.gz ."
now this does not work.. but i thought it might help you get an idea of what i am trying to do.
i shall endeavor to find the answer but if someone knows how to that would be great.
Thanks.
|
Check out the mtime and ctime params, but they may only work with Linux. You're going to be limited on what you can do with Windows, though.
I know there are lots of Perl modules for date/time string manipulation, which SHOULD work on Windows, but have no idea if it does or not. Perl SHOULD work under Windows, and let you write a script to do what you'd like, including SCP'ing a file. Check out CPAN.org.
|
|
|
11-18-2008, 10:26 PM
|
#3
|
LQ Newbie
Registered: Nov 2008
Posts: 7
Original Poster
Rep:
|
What if i was doing it from linux, how would i go about it?
|
|
|
11-19-2008, 08:56 AM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,476
|
Quote:
Originally Posted by Shinigami101
What if i was doing it from linux, how would i go about it?
|
Same way, or you could write a BASH script, which would work with ctime/mtime/atime. Lots of different ways to do things...
|
|
|
All times are GMT -5. The time now is 07:17 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|