On 04/23/2014 11:58 PM, m.r...@5-cent.us wrote:
This really isn't about R, but configuring R. We're running R 3.0.2-1, the
current default package, on CentOS 6.5 On a long-running job, R is
creating files in /dev/shm: each set of three files are named (8 hex
digits)-(4 hex digits)-(4 hex digits)-(4 hex digits)-(12 hex digits), and
then sem.(same as the name)_counter_mutex, and (same as the name)_counter.

For example,
156d23b0-9e67-46e2-afab-14a648252890
156d23b0-9e67-46e2-afab-14a648252890_counter
sem.156d23b0-9e67-46e2-afab-14a648252890_counter_mutex

Is there some way to configure R to add a prefix, say, to each of these
files? We're running rkhunter (rootkit hunter) for security, and it
complains about suspicious files, and I'd like some way to be able to tell
it to, say, ignore R_temp.whatever....

Hi mark,
I assume that the problem is to identify the files in /dev/shm, not to simply change your R code to tack the prefix onto the files as it produces them. As your hexadecimal digits are probably randomly generated, the solution may be to identify all the files that have "_counter_mutex" in the name, then chip off the appropriate bits to get the troublesome first name.

filenames<-list.files(pattern="_counter_mutex")
# function to return the two other filenames
strip_fn<-function(x) {
 f2<-substr(x,5,nchar(x)-6)
 f1<-substr(f2,1,nchar(f2)-8)
 return(c(f1,f2))
}
# get all the filenames
filenames<-c(filenames,unlist(sapply(filenames,strip_fn)))
# stick on the prefix
newfilenames<-paste("R_temp",filenames,sep=".")
# create the commands
fnmove<-paste("mv",filenames,newfilenames)
# move the filenames
for(fn in 1:length(fnmove)) system(fnmove[fn])

Warning - I haven't tested the last bit of this, but it should work. There is probably some really neat string of heiroglyphs in a regular expression that will do this as well.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to