Thanks for your info, ehud. I found this ( http://www.howtoforge.com/triggering-commands-on-file-or-directory-changes-with-incron) to be much easier to use.
Thanks, Hetz 2011/6/14 Ehud Karni <e...@unix.mvs.co.il> > On Mon, 13 Jun 2011 17:38:26 Hetz Ben Hamo wrote: > > > > I'm trying to find a solution to this issue: > > > > I'm running an sftp-server in ubuntu. Users can login and upload files. > > What I want to do is to run a script (on the server side) that after user > > logged in and uploaded a file. > > > > sftp-server man pages don't give any help about this issue. > > The `sftp-server' is a free program, so you can take the source and > fix it any way you want. I wanted to check this so I downloaded the > openssh source tar ball and looked at sftp-server.c . > > I found out that without any change, you can get a log message when > the `sftp-server' close a file, this message include the file name > and the number of bytes read and written. By watching this log you > can do whatever you want after each action. > > Since these are informative messages, You must change the `sftp-server' > logging level to INFO, by adding "-l INFO" arguments to the `Subsystem' > command in the /etc/ssh/sshd_config file. > > If don't want the messages in the SYSLOG, you can add the "-e" argument > and redirect the stderr (i.e ... -l INFO -e 2>>/dir/.../log-file). > > You can use a FIFO file when redirecting so you can read the messages > by a program or script directly. (please note, every time the sftp > session ends, there is an EOF on the reading side, so you must restart > to read). > > I did not check what happens when more then one `sftp-server' is > running, I leave it to you. > > The messages from a short session: > session opened for local user ehud from [192.168.3.6] > open "/var/tmp/chk-ip.sh" flags WRITE,CREATE,TRUNCATE mode 0770 > close "/var/tmp/chk-ip.sh" bytes read 0 written 1326 > remove name "/var/tmp/chk-ip.sh" > session closed for local user ehud from [192.168.3.6] > > Ehud. > > > -- > Ehud Karni Tel: +972-3-7966-561 /"\ > Mivtach - Simon Fax: +972-3-7976-561 \ / ASCII Ribbon Campaign > Insurance agencies (USA) voice mail and X Against HTML Mail > http://www.mvs.co.il FAX: 1-815-5509341 / \ > GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry > -- *חץ בן חמו חץ-ביז *השכרה ואירוח של שרתים פיזיים מעוניין להשתמש בשרותים שחסומים לגולש הישראלי? Hulu? NetFlix? Pandora? Google Voice? אם כן, כנס לכאן <http://vps.net.bz/?p=406>.
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il