Brian K. White
brian at aljex.com
Fri Nov 11 13:59:10 MST 2011
Is there any way to specify a file to be deleted on the remote side
explicitly by name?
I would have thought that deleting the file locally, the rsyncing the
non-existing file with --del would have resulted in the remote file,
which does exist being deleted.
I have a general purpose script that my developers use to push updates
from a devel box to all production boxes. It's essentially just a small
loop that reads a text file for a list of target machines, and rsyncs
the file/dir supplied on the command line to every host.
The rsync command in the script might be handed any kind of path from
anywhere in the filesystem, and the remote boxes are not full exact
clones of the source box, merely a developer know when they want to push
out a specific file that will be the same on all.
I am trying to add delete support to this, so that a developer can say
"delete this file on all"
Ideally I specifically want to do this with rsync alone of possible,
because I happen to already have rsync modules and rsync daemons
configured everywhere, and I want this to be able to work independent of
Specifically, in fact I want to be able to use this to enable and break
ssh, delete an ssh key on all boxes or push out a sshd_config file to
all boxes, which would intentionally break the ability to use, say,
pdsh, to run a rm command on all boxes using ssh.
The idea is to let a developer briefly enable and then disable the
ability to use pdsh, by pushing out ssh keys and config to allow it, do
their jobs, then remove the ssh keys again.
In this particular example, and because of this particular setup between
these particular boxes, I could do this by rsyncing the entire .ssh
directory, It's ok in this case to empty out or rename all the files in
the one local .ssh directory and push it out to all others with normal
--del, but really I would like the tool to be more natural and
generically useful so they could use it to name a specific file to be
deleted on the remote side some how, without syncing the whole directory
it's in or touching anything at all except exactly the single file
specified, the same as they can for creating or updating a file already.
The only way I can think of right now would be to detect that the user
wants a deletion, and in that special case instead of the normal push
rsync from local dev to remote production, do a pull rsync from the
remote production box to the local devel box, using
--remove-source-files, then delete the local file using normal rm locally.
More information about the rsync