Sponsored Content
Top Forums Shell Programming and Scripting rouch acts strange after touching around Post 302538835 by blah0 on Thursday 14th of July 2011 10:07:19 AM
Old 07-14-2011
rouch acts strange after touching around

hi there

Strange title? Well yes...it is strange..."touch" is driving me nutts! Trying to set the access / modified date by a bash script. For a certain time everything works well with all files. After point x the code works only for some files, for others it doesn't. After looking for the cause, I saw that it is a permission issue..so I checked on which permission the access time is no longer editable.

For me, that doesn't make sense at all. I'm logged in as root and am owner of the file. I also don't know what cause that problem....after a reboot, everything works well again. Had anybody already the same problem? What could cause this strange behavior?

The command:
Code:
root@owned:/home/foobar# touch -t 201110101212 test

The output:
if it works:
Code:
root@owned:/home/foobar# stat -c "atime: %x  mtime: %y ctime: %z" test
atime: 2011-10-10 12:12:00.000000000 +0200 
mtime: 2011-10-10  12:12:00.000000000 +0200
ctime: 2011-07-13 14:34:04.383508864 +0200

else:
Code:
atime: 2011-07-13 14:30:21.398403162 +0200 
mtime: 2011-10-10 12:12:00.000000000 +0200
ctime: 2011-07-13 14:30:20.386398151 +0200



List of permissions where it work / doesn't work:
Code:
-r-------- 1 root root 5 2011-07-13 14:11 test //ATIME & MTIME
-rw------- 1 root root 5 2011-10-10 12:11 test //ATIME & MTIME
-rwx------ 1 root root 5 2011-10-10 12:12 test //ATIME & MTIME
  
----r----- 1 root root 5 2011-10-10 12:14 test //ATIME & MTIME
----rw---- 1 root root 5 2011-10-10 12:15 test //ATIME & MTIME
----rwx--- 1 root root 5 2011-10-10 12:16 test //ATIME & MTIME
  
-------r-- 1 root root 5 2011-07-13 14:23 test //MTIME
-------rw- 1 root root 5 2011-07-13 14:25 test //MTIME
-------rwx 1 root root 5 2011-07-13 14:25 test //MTIME
  
-r-----r-- 1 root root 5 2011-07-13 14:27 test //MTIME
-rw----rw- 1 root root 5 2011-07-13 14:28 test //MTIME
  
-rw-r----- 1 root root 5 2011-10-10 12:10 test //ATIME & MTIME
-rw-r--r-- 1 root root 5 2011-07-13 14:30 test //ATIME

The influence are the "other" rights. As soon as it is readable for "other", the modified time is no longer editable. Again, this happens only after....well...after point x....

OS/Kernel
Linux owned 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux

best,
/dev/blah

Last edited by blah0; 07-14-2011 at 01:30 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

strange

Hi All I am doing a locate <file_name> on my Redhat 7 System. I am unable to get the output. All the keep getting is: locate: this is not a vlaid slocate database: /var/lib/locate/slocate.db What des this mean? Is my system compromised? Thanks in advance. KS (13 Replies)
Discussion started by: skotapal
13 Replies

2. Solaris

Something strange...

Hi all, Thanks for any replies and for reading in advance. We have upgraded one of our database instances to 10g on a Solaris 8 box, anyhow the other day it started trying to ping loads of weird IP addresses that we don't use, since our systems all run on pretty similar IP's. It all behind... (0 Replies)
Discussion started by: B14speedfreak
0 Replies

3. Programming

touching a file which contains slash char

i need to create a file which contains (/) character. Any help to do this (1 Reply)
Discussion started by: axes
1 Replies

4. Shell Programming and Scripting

Is there any s/w acts like UNIX?

Hi Frnds, I do not have UNIX OS and I am practicing on shell programming. is there any software that acts like UNIX? just to practice shell programming. Thanks in advance, Rashmy. (6 Replies)
Discussion started by: smr_rashmy
6 Replies

5. Programming

Help with a C program that acts like the make utility

Hi, I'm trying to create a C program that functions like the make utility in UNIX for personal use. My program would read in from a generic makefile and execute whatever is in that makefile but I'm not sure as to where I should start coding. I would appreciate any help. Thanks. (1 Reply)
Discussion started by: kratos.
1 Replies

6. UNIX for Dummies Questions & Answers

Changing rights without touching user and group?

Hello, I have a small problem and would be happy if someone could help me to find a solution: A machine ("server") makes backups of different computers ("clients") using rsync. Users and groups are keept, so that it's possible to copy them back to the client if required. The number of groups... (3 Replies)
Discussion started by: tracer
3 Replies

7. UNIX for Dummies Questions & Answers

Touching files?

So, I think this is a really stupid question, but I'd like to see if I am right. If the following commands are entered: umask 000 touch file1 umask111 touch file2 ...nothing should happen...right? The touch operation isn't going to apply any changes from umask to file1 (and same to... (1 Reply)
Discussion started by: Midwest Product
1 Replies

8. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

9. Shell Programming and Scripting

remove commas if touching any letters

I have a csv file that I am trying to edit. I need to remove any comma that is touching a letter. I used this command to find them. grep , moz_places_good.csv | head -n 10 | grep ,I would think I could use some form of this to just delete the commas and not the letter before it. Just not sure... (5 Replies)
Discussion started by: cokedude
5 Replies
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy