Operating System - HP-UX
1825768 Members
2053 Online
109687 Solutions
New Discussion

Re: Need help with a cp error please

 
SOLVED
Go to solution
jthrumston
Advisor

Need help with a cp error please

I have a ksh script I run in a user's cron. Part of the script calls for it to do a cp -p of a list of files from one sub-dir into another within the main directory. All of the files copy but occasionally I get the following error in that users email via cron.

cp: utime failed /storage/r2w-move/adm_er.asc: Not owner

The main directory is owned by the user and he is also a member of the group. The file is owned by another user who is also a member of the same group.

(ie. Main dir is owned by hbo:hbo, both subdirs are owned by samba:hbo, the file inside that sub-dir is owned by hbo:hbo, samba is a member of the hbo group). The permissions on the file are 664 and both sub-dirs and the main dir currently are 777 (just becuase I am in my testing).

I have googled this and can't seem to find an answer I understand. Can someone explain to me what exactly this means please.
If I wasn't here, I would be someplace else
7 REPLIES 7
Geoff Wild
Honored Contributor

Re: Need help with a cp error please

Well...with cp -p you are asking to preserve modification time, access time, file mode, user ID, and group ID.

You say the file(s) copy anyways?

Sounds like the cp command can not set the permissons correctly...

Can you provide a ll of bothe the source and target file?

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Senthil Kumar .A_1
Honored Contributor

Re: Need help with a cp error please

Hi,

Your error,

cp: utime failed /storage/r2w-move/adm_er.asc: Not owner


Indicates, though "-p" should ideally perserve the modification time and access time, the cp you are involking seems to attempt to change the time stamp on the created file. Hence the "utime" system call is reporting the error saying you are not the owner of the file to change its time stamp. Atleast confirm that whether you copy has happened successfully, inspite of this error.

Check "man utime" for more details. Meanwhile let me check more on this issue. Quite interesting I should say.

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
jthrumston
Advisor

Re: Need help with a cp error please

Sure, thanks for responding.

It does not appear to copy after all. When I first looked at this the file was there but with a different time stamp on it, the file gets overwritten about every 4 hours. So, in fact the cp -p doesn't work. Question now for me is, all of the files daily are the same owner and group. There are about 300 a day. Why do I only get this error once in a while?

I will keep looking and come back here if I need more help. Thanks.
If I wasn't here, I would be someplace else
Senthil Kumar .A_1
Honored Contributor
Solution

Re: Need help with a cp error please

EUREKA,

Simulated your error,

$ cp -p test perm2
cp: utime failed test: Not owner


Just one thought, not too sure any way, I think the file /storage/r2w-move/adm_er.asc should be already existing before the cron performs the copy, Meaning the data part of the file is copied successfuly but is unable to change the inode time stamps because you are not the owner. I would suggest,why don't you empty the destination directory before the cron performs the "cp -p" copy that way I think you would not have this error.

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
jthrumston
Advisor

Re: Need help with a cp error please

Thank you Senthil. I was just noticing that the only files I get this error on are in fact the only ones that are produced multiple times of the day. Which would also explain why I don't get the error on the first copy of the day.

Thank you. I will work on this from here,

Appreciate the help!
If I wasn't here, I would be someplace else
Bill Hassell
Honored Contributor

Re: Need help with a cp error please

I notgiced the samba name...are these shared filesystems (ie, Samba/CIFS or NFS). If so, unexpected activity on the remote system may be causing the problems. The problem is occuring during directory operations which are particularly time-critical, so delays due to networks or shared access may be the issue.


Bill Hassell, sysadmin
jthrumston
Advisor

Re: Need help with a cp error please

They are only owned by samba, at one point CIFS was in use, that isn't the case anymore, we just haven't gone thru the process of changing the ownership. Good thought though. Thanks.
If I wasn't here, I would be someplace else