--- client-src/sendbackup.c.orig	Mon Dec  2 13:12:09 2002
+++ client-src/sendbackup.c	Fri Dec  6 12:25:59 2002
@@ -79,6 +79,30 @@
 void parse_backup_messages P((int mesgin));
 static void process_dumpline P((char *str));
 
+#define backup_cb_script libexecdir##"/backup_cb"
+#ifdef STDC_HEADERS
+static void backup_state_action(int state, char *host, char* disk, 
+				char *amdevice,	int level,char *dumpdate) 
+#else
+static void backup_state_action(state, host, disk, amdevice,level, dumpdate) 
+int state, level; 
+char *host, *disk, *amdevice, *dumpdate;
+#endif 
+{
+    unsigned int cmdlen=strlen(backup_cb_script) + 5 + strlen(host) + 
+                        strlen(disk) + strlen(amdevice) + 11 + 
+                        strlen(dumpdate) + 7;
+    uid_t uid = getuid();	
+    char *cmd=(char*)malloc(sizeof(char)*cmdlen);
+    sprintf(cmd,"%s %5s %s %s %s %d %s",backup_cb_script, state?"start":"stop",
+            host, disk, amdevice, level, dumpdate);
+    /**For this to work sendbackup must belong to root and user s-bit 
+       must be set */
+    setresuid(0,-1,-1);
+    system(cmd);
+    setresuid(uid,-1,-1);	
+    free(cmd);
+}
 
 char *optionstr(option_t *options)
 {
@@ -455,9 +479,15 @@
       error("error [opening mesg pipe: %s]", strerror(errno));
     }
 
+    backup_state_action(1 ,g_options->hostname, disk, amdevice, level, 
+			dumpdate);
+
     program->start_backup(g_options->hostname, disk, amdevice, level, dumpdate,
 			  dataf, mesgpipe[1], indexf);
     parse_backup_messages(mesgpipe[0]);
+
+    backup_state_action(0 ,g_options->hostname, disk, amdevice, level,
+			dumpdate);
 
     amfree(prog);
     amfree(disk);
