This is a discussion on ftp backup failed with ncftp within the Shell scripting forums, part of the Development/Scripting category; hi, i have used the generated backup script from nixCraft. I tried command line to run my scripts, but failed ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
hi, i have used the generated backup script from nixCraft.
I tried command line to run my scripts, but failed at the ncftp area whereby the error is: ===================== MKD /home/backup/incremental failed; [Create directory operation failed.] Could not mkdir /home/backup/incremental: server said: Create directory operation failed. MKD /home/backup/incremental/07-07-2008 failed; [Create directory operation failed.] Could not mkdir /home/backup/incremental/07-07-2008: server said: Create directory operation failed. Could not chdir to /home/backup/incremental/07-07-2008: server said: Failed to change directory. =========================== I am running centos 5 and installed the lastest ncftp-3.2.1-linux-x86-glibc2.3-export.tar.gz file. i have given permission for the dir to be writable. Any help? I have searched and found it might be the ncftp config. This is my ncftp config: ### FTP server Setup ### FTPD="/home/backup/incremental" FTPU="backup" FTPP="mypass" FTPS="my.site.com" NCFTP=$(which ncftpput) Thanks if anyone can shed some light. |
| Sponsored Links | ||
|
|
|
|||
|
funny thing is that i tried the comman line > ncftp -u backup my.site.com.
login and tried to create dir incremental and change directory it is okay. but when i invoked my sh script to do the backup, it failed to create the very same directory? i am using root to run the sh. |
|
||||
|
can you paste your script here? Make sure you use full path name in shell script.
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
|||
|
Hi my script can be found below. I only changed the server addr and user/pass.
#!/bin/bash # System + MySQL backup script # Full backup day - Sun (rest of the day do incremental backup) # Copyright (c) 2005-2006 nixCraft <Contact / Email us> # This script is licensed under GNU GPL version 2.0 or above # Automatically generated by FTP MySQL and Webserver System Backup script # --------------------------------------------------------------------- ## System Setup ### DIRS="/var/www/data-backup" BACKUP=/tmp/backup.$$ NOW=$(date +"%d-%m-%Y") INCFILE="/root/tar-inc-backup.dat" DAY=$(date +"%a") FULLBACKUP="Sun" ### MySQL Setup ### MUSER="root" MPASS="mysqlpass" MHOST="localhost" MYSQL="$(which mysql)" MYSQLDUMP="$(which mysqldump)" GZIP="$(which gzip)" ### FTP server Setup ### FTPD="/home/backup/incremental" FTPU="backup" FTPP="mypass" FTPS="my.site.com" NCFTP=$(which ncftpput) ### Other stuff ### EMAILID="admin@my.site.com" ### Start Backup for file system ### [ ! -d $BACKUP ] && mkdir -p $BACKUP || : ### See if we want to make a full backup ### if [ "$DAY" == "$FULLBACKUP" ]; then FTPD="/var/www/data-backup/full" FILE="fs-full-$NOW.tar.gz" tar -zcvf $BACKUP/$FILE $DIRS else i=$(date +"%Hh%Mm%Ss") FILE="fs-i-$NOW-$i.tar.gz" tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS fi ### Start MySQL Backup ### # Get all databases name DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')" for db in $DBS do FILE=$BACKUP/mysql-$db.$NOW-$(date +"%T").gz $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE done ### Dump backup using FTP ### #Start FTP backup using ncftp ncftp -u"$FTPU" -p"$FTPP" $FTPS<<EOF mkdir $FTPD mkdir $FTPD/$NOW cd $FTPD/$NOW lcd $BACKUP mput * quit EOF ### Find out if ftp backup failed or not ### if [ "$?" == "0" ]; then rm -f $BACKUP/* else T=/tmp/backup.fail echo "Date: $(date)">$T echo "Hostname: $(hostname)" >>$T echo "Backup failed" >>$T mail -s "BACKUP FAILED" "$EMAILID" <$T rm -f $T fi |
|
|||
|
if it helps, here is the part where the ncftp failed messages:
NcFTP 3.2.1 (Jul 29, 2007) by Mike Gleason (NcFTP Software: Contacts). Connecting to 68.178.255.99... (vsFTPd 2.0.5) Logging in... Login successful. Logged in to my.site.com. MKD /home/backup/incremental failed; [Create directory operation failed.] Could not mkdir /home/backup/incremental: server said: Create directory operation failed. MKD /home/backup/incremental/09-07-2008 failed; [Create directory operation failed.] Could not mkdir /home/backup/incremental/09-07-2008: server said: Create directory operation failed. Could not chdir to /home/backup/incremental/09-07-2008: server said: Failed to change directory. fs-i-09-07-2008-03h22m07s.tar.gz: 1.18 kB 0.98 MB/s mysql-mytestdata.09-07-2008-03:22:07.gz: 6.97 kB 6.24 MB/s mysql-information_schema.09-07-2008-03:22:07.gz: 384.00 B 374.25 kB/s mysql-mysql.09-07-2008-03:22:07.gz: 86.09 kB 34.99 MB/s mysql-test.09-07-2008-03:22:08.gz: 373.00 B 345.92 kB/s Thank you for using NcFTP Client. If you find it useful, please consider making a donation! NcFTP Client Donations |
|
||||
|
Do you have /home/backup/ directory on FTP server? Are permissions correct on /home/backup/ for ftp user?
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
|||
|
yes the dir /home/backup does exist and i even chmod 777 to it to test still no luck.
That dir belongs to user "backup". Is it to do with Vsftpd config? i m guessing cos i googled and some leads to that file. |
|
|||
|
guess what, i changed the following:
FTPD="/home/backup/incremental" to FTPD="incremental" and now it works! but not sure if called from cron job will it be oky need to check again. Based on the above i assume that ncftp logins the user "backup" and using fullpath it failed to create "incremental" dir into its own dir? or am i doing something wrong with the config? |
|
|||
|
look through the ncftp website..found ths line in the manual:
"This version of ncftp no longer does command-line FTP, since the main ncftp program is more of a browser-type program" Is this the case why fullpath mkdir (i.e. /home/backup/incremental) not working? |
|
|||
|
another problem...now i have server A which i want to backup the MySQL data and have this files ftp over to server B.
But server B is having sftp port 22 and ncftp seems not able to connect to sftp. Does this means i need to get another ftp client? any recommendation? sorry for so many post and questions..need to solve this asap. |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Failed to start the X server (your graphical user interface) | zillah | Linux software | 1 | 12-24-2007 04:57 PM |
| cdrom: open failed | piggy | Linux hardware | 1 | 08-02-2007 10:25 PM |
| mysql connect failed for root | raghuram | Databases servers | 1 | 02-15-2007 11:06 AM |
| Re-reading the partition table failed with error 16: Device | chiku | Linux software | 1 | 12-07-2006 08:45 PM |
| Failed in mysql_real_connect(): Can't connect to local MySQL | Linux software | 1 | 07-17-2006 02:05 AM | |