Re: shell wrapper to set ioctls before & after a command execution?

Giacomo Mulas <[email protected]>
Newsgroups gmane.linux.debian.ports.amd64
Message-ID <[email protected]>
On Thu, 6 Jun 2013, Robert Goley wrote:

> That sounds like a good idea but you would need to blacklist the PIDs of the
> commands called from your backup script as well.  Most likely, they are the
> processes opening all of the files to start with.  You might want to look at
> using a python script for your backup script so you can more easily capture
> the PIDs of the executed commands.  

Actually, I use backuppc, which in turn just uses rsync (with a lot of
options). So it just gets down to substituting vanilla rsync with a wrapped
rsync. But in general, yes, you are completely right. So far, I came up with
this (generic) wrapper script:

#! /bin/bash
CACHEDEVICES="/dev/mapper/capitanatacache"

$* &

mypid=$!

for dev in ${CACHEDEVICES} ; do flashcache_setioctl -a -b ${mypid} ${dev} ; done
wait ${mypid}
exitcode=$?
for dev in ${CACHEDEVICES} ; do flashcache_setioctl -r -b ${mypid} ${dev} ; done

exit ${exitcode}

Now I have to implement it through my updatedb (and similar) cron jobs, and
my backup system.

Ciao
Giacomo

-- 
_________________________________________________________________

Giacomo Mulas <[email protected]>
_________________________________________________________________

OSSERVATORIO ASTRONOMICO DI CAGLIARI
Str. 54, Loc. Poggio dei Pini * 09012 Capoterra (CA)

Tel. (OAC): +39 070 71180 248     Fax : +39 070 71180 222
Tel. (UNICA): +39 070 675 4916
_________________________________________________________________

"When the storms are raging around you, stay right where you are"
                          (Freddy Mercury)
_________________________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.