Question : Shell Script find command problem

How do i delete files that are 4 hrs old using find command? we are using AIX so -mmin will not work. -mtime can work. How can i do that?

Answer : Shell Script find command problem

Actually i did not applied the solution you provided. But i was able to work my way around. Anyways i have one question. What i am trying to do over here is use a for loop first see for the directories which contains " test " folder. If the folder contains test folder then create the same directory structure on other remote machine. If any of that directory is not created then mail to appropriate person.

Same thing goes for scp and chmod also. this is what i am doing right now but everytime i run my script i get "done " expected. Can anyone look into it ?

Thanks

Use
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
 LOG_FILE_DIR="/home/mike/" 
   LOCAL_LOG_FILE=$LOG_FILE_DIR/"server_`date +%m%d%Y`.log" 
   SENDMAIL=0 
   MAIL_FILE=tmp.txt 
   REMOTE_DIR="/home/john" 
 
   for dir in /home/mike; do 
 
   if [ -d ${dir}/"test" ]; then 
   /usr/local/bin/ssh -l melo ferrari "mkdir -m 777  $REMOTE_DIR/$dir" >>$LOCAL_LOG_FILE 2>&1 
   if [ $? != 0 ]; then 
   SENDMAIL=1 
   echo "Cannot create directory $dir " >> MAIL_FILE 
   fi 
 
   scp -r ${dir}/"test" ferrari:$REMOTE_DIR/${dir}/ 
   if [ $? != 0 ]; then 
   SENDMAIL=1 
   echo "Cannot create directory $dir " >> MAIL_FILE 
   fi   
 
   /usr/local/bin/ssh -l melo ferrari "chmod -R 777 $REMOTE_DIR/$dir" 
   if [ $? != 0 ]; then 
   SENDMAIL=1 
   echo "Cannot change the chmod for $dir " >> MAIL_FILE 
   fi 
 
   fi
   done 
 
  mail -s "[email protected]" < MAIL_FILE 
 
  exit 0
Open in New Window Select All
Random Solutions  
 
programming4us programming4us