Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: How to let perl knows if somebody copies a file

by rovf (Priest)
on Sep 17, 2012 at 09:17 UTC ( [id://993997]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to let perl knows if somebody copies a file
in thread How to let perl knows if somebody copies a file

I thought there was a file like /etc/profile for per-interactive-shell startup.
Using /etc/profile for type of work has the drawback, that this file is not sourced always, but only if the bash is invoked as login-shell, and the --noprofile option is not used.

Which is what the OP asked.
Not sure of this. The OP said f somebody uses the copy command in bash, which is different from saying if somebody uses the command 'cp' from the command line. For example, the user might invoke a shell script, which contains a command to copy the file (maybe cp, maybe a different one), and this would then not necessarily be monitored.

Honestly, I don't know the deeper purpose for the OP's request. If he just want to spare his users the task to explicitly run his Perl scripts after each copying process, he could simply provide a script for doing copying+inspecting, and ask the users to run his script instead of using the original cp commmand. Of course, any user is then free to put an alias to this script in his or her .bashrc, and this would work in a similar way for ksh or zsh too.

On the other hand, if the OP wants to enforce this type of check, because he suspects that the users, on purpose, might not use his script, all alternatives discussed here are very easy to bypass.
-- 
Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://993997]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 21:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found