- print(LOG $bpc->timeStamp,
- "User $user requested backup of $host"
- . " ($hostIP)\n");
- if ( $BgQueueOn{$hostIP} ) {
- @BgQueue = grep($_->{host} ne $hostIP, @BgQueue);
- $BgQueueOn{$hostIP} = 0;
- }
- if ( $UserQueueOn{$hostIP} ) {
- @UserQueue = grep($_->{host} ne $hostIP, @UserQueue);
- $UserQueueOn{$hostIP} = 0;
+ #
+ # Handle numeric backupType for backward compatibility
+ # (technically -1 is a new feature for auto)
+ #
+ $backupType = 'auto' if ( $backupType eq '-1' );
+ $backupType = 'doIncr' if ( $backupType eq '0' );
+ $backupType = 'doFull' if ( $backupType eq '1' );
+ if ( $backupType !~ /^doIncr|doFull|autoIncr|autoFull|auto$/i ) {
+ $reply = "error: unknown backup type $backupType";
+ } else {
+ print(LOG $bpc->timeStamp,
+ "User $user requested backup of $host"
+ . " ($hostIP)\n");
+ if ( $BgQueueOn{$hostIP} ) {
+ @BgQueue = grep($_->{host} ne $hostIP, @BgQueue);
+ $BgQueueOn{$hostIP} = 0;
+ }
+ if ( $UserQueueOn{$hostIP} ) {
+ @UserQueue = grep($_->{host} ne $hostIP, @UserQueue);
+ $UserQueueOn{$hostIP} = 0;
+ }
+ my $status = QueueOnePC($host, $hostIP, $user, 'user', $backupType);
+ if ( $status == 0 ) {
+ $reply = "ok: requested backup of $host ($backupType)";
+ } elsif ( $status == 1 ) {
+ #should never see this we just dequeued it
+ $reply = "warning: $host was already queued."
+ . " Ignoring this request";
+ } elsif ( $status == 2 ) {
+ print(LOG $bpc->timeStamp,
+ "Disk too full ($Info{DUlastValue}%)."
+ . " Not queueing backup of $host\n");
+ $reply = "error: disk too full ($Info{DUlastValue}%)";
+ $Info{DUDailySkipHostCnt}++;
+ } elsif ( $status == 3 ) {
+ # should never reach this because
+ # it's set to "user" above
+ $reply = "error: unknown queue name";
+ } else {
+ $reply = "error: unknown queue status $status";
+ if ( $BgQueueOn{$hostIP} || $UserQueueOn{$hostIP} ) {
+ $reply .= ". Host is queued.";
+ } else {
+ $reply .= ". Host is not queued.";
+ }
+ }