http://www.perlmonks.org?node_id=951405

dmsparts has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am trying to write a script that will trigger a backup of an SQL database from a remote copmuter. The script i have below seems to work, i dont get any errors. however, the backup file appears in the specified directory then dissapears after about 4 or 5 seconds. i need to be able to call this script from a browser so anyone can do the backup. the file would then be accesible on a network share to be copied to a USB drive.

does anyone have any ideas why it would do this??

#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use DBI; print "Content-type: text/html\n\n"; my $dbs = "DBI:ODBC:DRIVER={SQL Server};SERVER={dmssql01};DATABASE={sa +ge200_dmstestconversion}"; my ($username, $password) = ('user', 'passwd'); my $dbh = DBI->connect($dbs, $username, $password) or die "$DBI::errst +r\n"; my $sth = $dbh->prepare( 'backup database sage200 to DISK = \'d:\sage\ +sage200data\sagebackup2.bak\' ;') or die "Couldn't prepare statement: + " . $dbh->errstr; $sth->execute() or die "execute failed: " . $sth->errstr(); $sth->finish(); $dbh->disconnect(); print "Backup Completed";

Thanks for your help