0
I have a cron script and i need to adjust it; Actually some clients are generating in a directory some files, my task is to backup that files to a tape, and i need to make a if then else
cp $files $tape
if exit 0
then
send successfully mail
delete files
else
send a fail mail
but don't delete that files
fi
Could someone help me with that?
Maybe with something like that? Actually the code is like that
find $STR_FILES -print | backup -ivq -f $TAPE >> /tmp/logfile
you say that i must put something like that?
BKP='find $STR_FILES -print | backup -ivq -f $TAPE'
$BKP >> /tmp/logfile
if [$BKP -eq 0 ]
then
...
else
...
fi
?
Actually i did as a test
Actually i did cd / find /u01 -name ora_856562.aud
if ["$?" = "0" ]; then
rm /u01/app/oracle/product/10.2.0/db_1/rdbms/audit/ora_856562.aud
(echo "Se depuraron *.aud Ok") | mail -r oracle_alfa@notification.imcl-peoplesoft.com -s "Prueba if" egrc77@hotmail.com
else
(echo "NO Se depuraron *.aud Ok") | mail -r oracle_alfa@notification.imcl-peoplesoft.com -s "Prueba if" egrc77@hotmail.com
fi
exit
but fails with
./prueba.sh[3]: 0: not found.
./prueba.sh[5]: [127: not found.
The mail script code i have and is working fine, actually the code is this
find $STR_FILES -print | backup -ivq -f $TAPE >> $TMP_LOG_DLS
BKP='find $STR_FILES -print | backup -ivq -f $TAPE'
if [$BKP -eq 0 ]
? – user324868 – 2014-05-19T12:23:15.937
the $? variable holds the exit status of the last command executed. You don't need to check the value of $BKP, just the exit status of the operation in which you you perform the backup – Bruno9779 – 2014-05-19T12:47:51.827
Actually i did as a test – user324868 – 2014-05-19T15:24:06.730
Actually i did cd / find /u01 -name ora_856562.aud