- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: error: find: cannot get 'pwd'
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:18 AM
01-20-2004 02:18 AM
find $BACKUP_LOGS_DIR -name archbu.log.* -type f -mtime +7 -exec /bin/rm -f {} ";"
##
## Remove archive backup log files in $BACKUP_DEPOT
##
echo ""
echo "Removing previous copies of archlogs in $BACKUP_DEPOT..."
find $BACKUP_DEPOT -name archive_logs.*.bz2 -type f -mtime +7 -exec /bin/rm -f {} ";"
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:22 AM
01-20-2004 02:22 AM
Re: error: find: cannot get 'pwd'
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:26 AM
01-20-2004 02:26 AM
Re: error: find: cannot get 'pwd'
May be a stupid question but in what dir do you start this script.
check pwd before you start/ execute the script.
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:35 AM
01-20-2004 02:35 AM
Re: error: find: cannot get 'pwd'
Your problem (assuming all else is correct) is here:
-name archbu.log.*
this should be:
-name 'archbu.log.*'
You need to quote the pattern so that find rather than the shell itself instantiates the wildcarding.
Also replace -f {} ";" with -f {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:36 AM
01-20-2004 02:36 AM
Re: error: find: cannot get 'pwd'
0 3 * * 6 su acadmin -c /home/bu/scripts/backup/backup_acdb.sh > /home/bu/log/backup_acdb.log.`date +\%j`
I also set the variables at the beginning of the script...
BACKUP_DEPOT=/opt/app/oracle/oradata/acdb/db5
BACKUP_LOGS_DIR=/home/bu/log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 02:48 AM
01-20-2004 02:48 AM
Re: error: find: cannot get 'pwd'
set -u
at the beginning of your script. Then, to actually trace your script, put set -x at the beginning of the script and you'll get a mail message with the trace results. Also, if your script works OK when you run it manually but fails in cron, remember that cron does not login so you don't have the same environment.
Also, it's important to protect any -name expressions so that find will parse the special characters. Put the expression string in single quotes: -name 'archbu.log.*' or -name 'archive_logs.*.bz2'
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 03:11 AM
01-20-2004 03:11 AM
Re: error: find: cannot get 'pwd'
+ find /home/bu/log -name archbu.log.* -type f -mtime +7 -exec /bin/rm -f {} ;
find: cannot get 'pwd'
+ echo
+ echo Removing previous copies of archlogs in /opt/app/oracle/oradata/acdb/db5...
+ find /opt/app/oracle/oradata/acdb/db5 -name archive_logs.*.bz2 -type f -mtime +7 -exec /bin/rm -f {} ;
find: cannot get 'pwd'
I am at a loss, I have it working properly on another machine... (same script)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 03:31 AM
01-20-2004 03:31 AM
Re: error: find: cannot get 'pwd'
try finishing your find command with space backslash semicolon, e.g.:
{} \;
instead of the qouted semicolon.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 05:31 PM
01-20-2004 05:31 PM
Re: error: find: cannot get 'pwd'
The message you get is something that happens when you try to find your path in a directory that is not readable/executable by the user. You say you are root, so in normal cases that's not the case (root bypasses normal security) UNLESS... there is a NFS mounted directory in the path (or perhaps the complete tree). '-xdev' might solve the problem in the first case, otherwise run the script on the NFS server instead of the NFS client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2004 09:53 PM
01-20-2004 09:53 PM
Solutionhome_fd = open(".", O_RDONLY)
So the effective user calling find(1) cannot open the current working directory for reading.
From root's crontab you call:
su acadmin -c ...
The script is called as user 'acadmin' with root's HOME directory as working directory. Assuming that no cd(1) is done inside your script, are you sure that 'acadmin' has read permission to this directoty?
Check this:
# su acadmin -c 'ls ~root'
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2004 03:51 AM
01-21-2004 03:51 AM
Re: error: find: cannot get 'pwd'
I think you are right, it may be a permissions problem, the script works perfectly on another machine.
Thanks for all the help.