LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 02-16-2018, 07:47 PM   #1
redhatwannabe
Member
 
Registered: Dec 2008
Posts: 83

Rep: Reputation: 15
how to exempt path from housekeeping for 8 days


Dear Sir/Mdm,

Code:
/home/oracle/dba/scripts/memory/log/*.log
/home/oracle/dba/scripts/backup/rman_backup/log/*.log
/home/oracle/dba/scripts/backup/transfer/log/*.log
/home/oracle/dba/scripts/nls_characteterset/log/*.log
I have a list of *.log that need to be deleted after 8 days except /home/oracle/dba/scripts/backup/transfer/log/*.log

How do I exclude /home/oracle/dba/scripts/backup/transfer/log/*.log from being deleted after 8 days

Code:
export FIND="/usr/bin/find"
export script_base="${HOME}/dba/scripts"
export script_level=5

export DAYS=8
let "MIN=${DAYS}*24*60"

$FIND "${script_base}" -maxdepth "${script_level}" -path "{$script_base}/backup/remote_ops/log" -prune -o "\*.log" -mmin +"${MIN}" -exec rm {} \;
when I run the code I come across the following:
Code:
/usr/bin/find: paths must precede expression: \*.log
Usage: /usr/bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
so how do I exclude /home/oracle/dba/scripts/backup/transfer/log from being deleted after 8 days?

many thanks in advance
 
Old 02-17-2018, 10:08 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by redhatwannabe View Post
Dear Sir/Mdm,
Code:
/home/oracle/dba/scripts/memory/log/*.log
/home/oracle/dba/scripts/backup/rman_backup/log/*.log
/home/oracle/dba/scripts/backup/transfer/log/*.log
/home/oracle/dba/scripts/nls_characteterset/log/*.log
I have a list of *.log that need to be deleted after 8 days except /home/oracle/dba/scripts/backup/transfer/log/*.logHow do I exclude /home/oracle/dba/scripts/backup/transfer/log/*.log from being deleted after 8 days
Code:
export FIND="/usr/bin/find"
export script_base="${HOME}/dba/scripts"
export script_level=5

export DAYS=8
let "MIN=${DAYS}*24*60"

$FIND "${script_base}" -maxdepth "${script_level}" -path "{$script_base}/backup/remote_ops/log" -prune -o "\*.log" -mmin +"${MIN}" -exec rm {} \;
when I run the code I come across the following:
Code:
/usr/bin/find: paths must precede expression: \*.log
Usage: /usr/bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
so how do I exclude /home/oracle/dba/scripts/backup/transfer/log from being deleted after 8 days?
You use the correct syntax for the find command, which you have not. You've been asking about scripting/find for at least three years now. I suggest you go back to your previous threads about find/scripting, and apply what you've been told in the past, read the man page on "find", and check out the MANY bash scripting tutorials you can easily find.
https://www.linuxquestions.org/quest...me-4175562243/
 
Old 02-22-2018, 01:15 PM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,781

Rep: Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199
You certainly want -name "*.log" i.e. you missed the -name.
Consider to augment it with -type f.
 
  


Reply



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
IP rule help -cant exempt directly connected routes from VPN 0.0.0.0/0 sloppytypist Linux - Networking 9 03-30-2017 10:15 PM
'Housekeeping' with /etc/rc.d/rc.local_shutdown? andrew.46 Slackware 3 08-05-2008 07:59 PM
LXer: FSF says Microsoft not exempt from GPLv3 LXer Syndicated Linux News 0 08-29-2007 10:11 PM
LXer: Microsoft cannot declare itself exempt from the requirements of GPLv3 LXer Syndicated Linux News 0 08-28-2007 09:20 PM
How could I exempt char to grep? packets Programming 2 07-17-2007 07:49 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 09:05 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