Hi, im trying to make a script that backups mysql databases but apparently I am having trouble with the variables, or simply something I am missing.
Would appreciate any help, here is the script
#!/usr/bin/perl -w
use strict;
require File::Spec;
#VARIABLES
my $databasename = 'test_db'; #project database name
my $scriptsdir = '/home/user/perl/'; #script directory
my $project = 'kor'; # backup folder name, as created it on sftp server
my $backupdir = 'b0000000@hanjin.dreamhost.com:/test/'; #backup host directory
#date settings
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $ymd = sprintf("%04d-%02d-%02d-%02d-%02d-%02d",$year+1900,$mon,$mday,$hour,$min,$sec);
my $outdb = '$ymd-$databasename.tar.gz';
#BACKUPS MYSQL DB INFO
##Checks which action was called and mysql db backup in case its daily
my $action = $ARGV[0] ? $ARGV[0] : "";
if ($action eq "daily") {
system('mysqldump -u root $databasename | gzip > $scriptsdir$outdb');
system('scp $scriptsdir$outdb $backupdir$project/daily.0');
system('rm $scriptsdir$outdb');
}
Is it some module I am missing here? the message I get when I run this is :
sh: cannot create : Directory nonexistent
again, thx for any help
ps: this is part of a bigger script that rsync snapshots to the ftp, that is why I am using perl, the rest of the script is working just fine, only having trouble with this particular part