Run shell script on a command

Posted by LinuxPenseur on Server Fault See other posts from Server Fault or by LinuxPenseur
Published on 2010-12-21T13:09:13Z Indexed on 2010/12/21 13:55 UTC
Read the original article Hit count: 367

Filed under:
|
|
|

Hi,

I want to run a shell script when date -s <string> command is used. For example i want to log the command to the file /tmp/user.log by executing the following command in the shell script

logger -p user.notice "date -s command executed" -f /tmp/user.log

How can run a shell script when date -s <string> is executed on the shell?

To make it more general, I want to run my shell script when someone else issues a particular linux command on my system. How to do this?

© Server Fault or respective owner

Related posts about linux

Related posts about scripting