LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 03-16-2012, 11:44 AM   #16
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405

Hi,

Which OS are you using? Linux (if so: which distro), hp-ux, solaris, sunos, aix, ..?
 
Old 03-16-2012, 11:49 AM   #17
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Have you tried your last line
Code:
find /home/evaxd4/FTP_CRON/ -name "pso_whse_orders_inout.*" -mtime +3 -exec rm -f {} \;
running manually from command line ?

What does it do ?

It may be you don't have $PATH to the Find command, so try use
Code:
/usr/bin/find .....
 
Old 03-16-2012, 11:51 AM   #18
evilputty
LQ Newbie
 
Registered: Mar 2012
Posts: 18

Rep: Reputation: Disabled
you'll need to parse filenames to go by date which is noted within the filename thats why the previous command will not work.
 
Old 03-16-2012, 11:54 AM   #19
arjundey
LQ Newbie
 
Registered: Sep 2011
Posts: 26

Original Poster
Rep: Reputation: Disabled
@druuna - It's a Solaris OS.

@lithos - When I type this command and hit enter, no error is thrown. It just feels like the command has been executed successfully but without effecting the idea behind it - the files to be purged still stays.

@evilputty - I'm new to Unix. Can you please elaborate on how this parsing could be done ?
 
Old 03-16-2012, 12:10 PM   #20
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by arjundey View Post
@druuna - It's a Solaris OS.
That is important information. Solaris is linux alike, but definitely not the same.

I've asked a moderator to move this to the Solaris sub-forum, which will improve the chances for getting the correct answer(s).
 
Old 03-16-2012, 01:14 PM   #21
evilputty
LQ Newbie
 
Registered: Mar 2012
Posts: 18

Rep: Reputation: Disabled
A little googlefu came up with this link.

http://www.linuxquestions.org/questi...please-276744/

Once the cron catches up you should be able to start using
Code:
find /home/evaxd4/FTP_CRON/ -name "pso_whse_orders_inout.*" -mtime +3 -exec rm -f {} \;
since its based off modified time not the time located within the filename.

you could use this script to set the modified time to the existing files to the date appended to the filename.
Code:
#!/bin/sh

for  filename in /location/to/pso_whse_orders_inout.*
do
     MODDATE=`echo $filename | sed -n 's/^.*\.\([0-9]*\)$/\1/p'`
     touch $filename -t $MODDATE"1200"
done;
not sure for solaris but it works fine with linux

Last edited by evilputty; 03-16-2012 at 02:41 PM. Reason: add script to change modified time
 
Old 03-16-2012, 03:13 PM   #22
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Moved: This thread is more suitable in Solaris/Opensolaris and has been moved accordingly to help your thread/question get the exposure it deserves. Thanks druuna for reporting.
 
Old 03-19-2012, 01:36 AM   #23
arjundey
LQ Newbie
 
Registered: Sep 2011
Posts: 26

Original Poster
Rep: Reputation: Disabled
I am sorry friends. I am actually using AIX Version 6.1 , not Solaris. Apologies !!!!

@colucix - Please move it again to the relevant forum.

@All - I am still not able to figure out the purging of files greater than 3 days old. Any ideas please?
 
Old 03-19-2012, 05:28 AM   #24
arjundey
LQ Newbie
 
Registered: Sep 2011
Posts: 26

Original Poster
Rep: Reputation: Disabled
Ok guys. I just figured out that the same command is working now as the problem was with the time of the file when it was created and not just in the date mentioned in the filename. The command

I am marking this thread as resolved now.

Sorry for the confusion on OS & thanks to everyone who contributed your valuable suggestions.
 
Old 03-24-2012, 04:08 PM   #25
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
As requested, moved to the AIX forum
 
Old 11-17-2015, 11:42 AM   #26
ashi.srma1986
LQ Newbie
 
Registered: Oct 2015
Posts: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by arjundey View Post
Thanks Druuna. FTP connectivity works now, but have 2 more issues to resolve with my script.

I have written this script for a FTP transfer, but I am not able to get the files in the required directory even after the cd command before connecting to FTP. I'm running this script from a different directory & I want the file to come into a specific directory. I assumed to change the working directory before connecting to FTP, but its not working. The file is coming to the same directory where I am running the script from. Please help ASAP.

Also, the script doesn't purge the files which are more than 3 days old. Pls help on this as well.

Note : Both are highlighted in BOLD below.

Code:
#!/bin/ksh

sdir="/var/mqm/tmp/pso/"
filename="pso_whse_orders_inout"
hostname="n0aif01"
username="evaxd4"
password="march2012"

`cd $sdir`
ftp -in $hostname <<EOF
quote USER $username
quote PASS $password

binary
cd $sdir
get $filename
quit
EOF

mv -f $filename $filename.`date '+%Y%m%d'`

find /home/evaxd4/FTP_CRON/ -name "pso_whse_orders_inout.*" -mtime +3 -exec rm -f {} \;
In the last command. I want to purge older than 3 days files.

Like for example, there are the following files in the directory :
pso_whse_orders_inout.20120312
pso_whse_orders_inout.20120313
pso_whse_orders_inout.20120314
pso_whse_orders_inout.20120315
pso_whse_orders_inout.20120316

Then the directory will be left over with the last 3 days' files :
pso_whse_orders_inout.20120314
pso_whse_orders_inout.20120315
pso_whse_orders_inout.20120316

Any ideas ?

how i can download all files from specific folder from remote computer
 
Old 11-18-2015, 03:41 AM   #27
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
> how i can download all files from specific folder from remote computer

Use wget(1)

Code:
wget -r ftp://user:pass@host//dir/
 
  


Reply

Tags
cron, crontab, ftp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/cron.daily/slocate.cron - multiple /usr/bin/updatedb degrades performance ray63 Linux - Server 2 01-05-2012 05:04 PM
Why is the text file format changing while transferring thru FTP ? apanimesh061 Programming 4 09-22-2011 02:56 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
Daily Cron jobs with a PHP file Gargomel7 Programming 7 09-13-2003 07:21 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 12:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration