Hello, I am working on implementing rsync to replace a server distribution mechanism that currently works like this: 1) process new file on backend server 2) upload file to frontend server using scp or rsync over ssh 3) ssh to frontend server to trigger script #3 is only used in a couple special cases I have this tested and working: 1) (same as above) 2) upload file to frontend server using rsync (with patch to rsynd to be verbose in error reporting) 3) (same as above) I would like to be able to trigger a script for #3 instead of having to ssh over (to make the frontend server a bit more autonomous, and simplify the process). I am already maintaining a fork of rsync for #2, so I don't mind making modifications to the source. Ideally I'd like to have a param on the client side like --trigger-script="script.sh", that will trigger a script on the server side only if the upload is successful. Does this seem reasonable, or am I just making things more complex for myself? :) Thanks! Rob
Robert, I think this would be a useful feature. I can think of how I could use a feature like that. If you are successful let me know. Thanks, Paul Enright Robert Helmer <robert@roberthel mer.com> To Sent by: rsync@lists.samba.org rsync-bounces+pen cc right=braums.com@ lists.samba.org Subject trigger command on successful upload? 06/14/2004 10:57 PM Hello, I am working on implementing rsync to replace a server distribution mechanism that currently works like this: 1) process new file on backend server 2) upload file to frontend server using scp or rsync over ssh 3) ssh to frontend server to trigger script #3 is only used in a couple special cases I have this tested and working: 1) (same as above) 2) upload file to frontend server using rsync (with patch to rsynd to be verbose in error reporting) 3) (same as above) I would like to be able to trigger a script for #3 instead of having to ssh over (to make the frontend server a bit more autonomous, and simplify the process). I am already maintaining a fork of rsync for #2, so I don't mind making modifications to the source. Ideally I'd like to have a param on the client side like --trigger-script="script.sh", that will trigger a script on the server side only if the upload is successful. Does this seem reasonable, or am I just making things more complex for myself? :) Thanks! Rob -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Hi, On Tue, 15 Jun 2004 PEnright@braums.com wrote:> I think this would be a useful feature. I can think of how I could use a > feature like that. If you are successful let me know.rsync has wonderful precise return codes. "man rsync" will tell. You can already do somehing like this: rsync ${OPTS} ${SRC} ${DST} >>${PROT} 2>&1 RC=$? if test "${RC}" = "0" -o "${RC}" = "23"; then echo "normal termination." elif test "${RC}" = "10"; then echo "no connection." elif test "${RC}" = "24"; then echo "OK, but some file(s) vanished." fi and distinguish many more cases. Cheers -e -- Eberhard Moenkeberg (emoenke@gwdg.de, em@kki.org)
If you're rsyncing over an external transport, I can't imagine what the issue is in running a postprocessing command over the same transport. But, if what you're looking for is a way to do this over rsync internal transport, and want to get rid of the remote shell, perhaps for security reasons, leave a daemon, or perhaps a cron-driven script, to watch for the appearance of a trigger file. If the rsync transfer finishes correctly, you send up the trigger file, which is harvested by the receiver, which performs the desired post-transfer processing. start pseudoscript:+++++++++++++++++++++++++++++++++++++++++++ [ -f "$triggerfile" ] || exit 0 rm $triggerfile perform whatever it is you wanted end pseudoscript:+++++++++++++++++++++++++++++++++++++++++++ Cronjob: * * * * * /path/to/the/script Tim Conway Unix System Administration Contractor - IBM Global Services desk:3032734776 conway@us.ibm.com I would like to be able to trigger a script for #3 instead of having to ssh over (to make the frontend server a bit more autonomous, and simplify the process). Does this seem reasonable, or am I just making things more complex for myself? :)