BackupPC-users

[BackupPC-users] signal to Kill DumpPreUserCmd

2014-07-24 16:49:02
Subject: [BackupPC-users] signal to Kill DumpPreUserCmd
From: Russell R Poyner <rpoyner AT engr.wisc DOT edu>
To: backuppc-users AT lists.sourceforge DOT net
Date: Thu, 24 Jul 2014 14:36:41 -0500
I have a bash script that runs on the BackupPC server as DumpPreUserCmd.

I'd like to have the script catch a signal and clean up it's files if a 
backup get's canceled while the script is running. So far I'm trapping 
INT, TERM, ABRT and ALRM but not getting what I want.

Does BackupPC send SIGKILL to the DumpPreUserCmd process? Or something 
else I haven't thought of?

The value of $Conf{UserCmdCheckStatus} seems to not matter.

Background:

This is in the context of a method to create shadow copies and start 
rsyncd on windows clients without having to remotely execute anything on 
the windows box via ssh or winexe.

1. The server starts our DumpPreUserCmd bash script which creates a file 
called <hostname>.html in a web-readable directory. It then polls the 
windows machine to see if rsyncd has started. Once windows starts it's 
rsyncd the PreUser script exits so that the dump can start.

2. The windows machine runs a script in task_scheduler every 5 minutes 
to see if the file <hostname>.html exists in the special directory on 
the BackupPC web server. If it does the windows box runs a powershell 
script that creates shadow copies, starts rsyncd and opens a firewall 
hole to allow the backup.

3. On the server when the dump completes DumpPostUserCmd runs and 
removes the <hostname>.html file.

4. When the periodic task on the windows machine no longer finds the 
<hostname>.html file it stops the rsyncd service, deletes the shadow 
copies, and closes the firewall hole.

It works fine unless the backup get's interupted while DumpPreUserCmd is 
running and waiting for windows to start it's rsyncd service. In that 
case the <hostname>.html file get's orphaned.

I *could* create a cron job on the server to look for and remove 
orphaned <hostname>.html files, but I'm hoping to not need that.

Thanks
Russ Poyner

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>