Sorry for this basic request. But I just started learning Ksh recently and still I am a newbie in this field.
Q: I have files on one server and the date format is 20121001000009_224625.in which has year (yyyy) month (mm) and date (dd). I have these files on server A. The task which I am trying to accomplish is: I need to fetch these files onto server B dated 30 days older, bzip them and put them on server C. This script would run as a cronjob in server B. All servers are sun solaris.
Could anybody please help me with the code on serverB? Any help would be greatly appreciated.
Currently I use scp to manually transfer the files onto server B from server A use bzip to compress them on server B and then again use scp to transfer them to server C(creating respective folders - eg. 201210 for oct 2012). But how can I include the conditions to check for name automatically (30 days old). how can i use scp as it prompts for passwords to be entered manually. Could you guide me accordingly please?
Basically what you do is:
create ssh-keys on server A, on server B, and on server C.
then put keys on whatever node you want to connect to.
So If I want to connect FROM A to C, I first have to put my "A" keys over on "C".
keys live in authorized_keys in a special directory under your login directory:
I am sorry if I put this wrongly.. but is the output going to give files older than 30 days or 30 days old? I am looking for older than 30 days.... Really sorry for mis-communicating.
For example: i will have files with 20121011.....dat 20120912....dat and many such months.
I want to just scp the files which are older than 30 days and scp them.