Friday, November 6, 2009

move a file from UNIX to windows via ftp

REQUIREMENT:

we had a requirement to get a file via ftp and then remove it off the source. The file was created with the "operations" user account. and for the backup we created a script file in which we had to use the user "backup".

SOLUTION:

The file was created using a script program on UNIX, after we created the file, we changed the rights for the file, using the following command

chown backup:operations backup_filename.extension

this means that I have changed the ownership of the "backup_filename" from user "operations" to user "backup”, why did i do it... let's see, the backup is created from user "operations", the script file which creates the backup file is owned by user " operations ". so since user " operations" is the owner, it can change the ownership, the command written above changes the ownership from user " operations" to user "backup".

Now all i have to do is to ftp from my windows machine, sign in with user "backup" get the file using get utility of FTP and then delete the file using the mdelete or mdel. I did this with a task where i do ...

ftp -s:commandfile.txt 999.999.999.999

where commandfile.txt lists all the steps of the ftp process, and 999.999.999.999 is the IP address of the UNIX machine.

this way
I don't have to hard code the root password;
I don't get any prompt for entering the root password;
this job can be scheduled to run any time.

if you need more help, send me an email, or reply to this post ... I will reply ASAP.

No comments:

Post a Comment