Sample Header Ad - 728x90

is it possible to use ctrl+z in bash script to send lftp process to background?

0 votes
1 answer
403 views
we have a database that we take backup from it every night. backup files are 6 separate files in 6 separate directories. after backup is taken successfully, all parts will lftp to a remote server. the lftp commands are generated by a bash script which redirect output to a file named ftpfiles.sh then execute it. here is the content of ftpfiles.sh: lftp -u user,pass 1.1.1.1 mkdir BackUp lftp user@1.1.1.:~> cd BackUp lftp user@1.1.1.:~> lcd /data10/customerBackup lftp user@1.1.1.:~> put CUSTOMER.0.DBPART000.20220705010003.001 'CUSTOMER.0.DBPART000.20220705010003.001' at 40555088 (1%) [Sending data] {I PRESSED CTRL+Z IN HERE} put CUSTOMER.0.DBPART000.20220705010003.001 & CUSTOMER.0.DBPART000.20220705010003.001 (8%) 45.85M/s eta:74s [Sending data] lftp user@1.1.1.:~> quit Moving to background to complete transfers... [root@autodb /]# i tried to achieve this in bash script but no luck. for example putting these in bash script: (put CUSTOMER.0.DBPART000.20220705010003.001) & put CUSTOMER.0.DBPART000.20220705010003.001 & so is it possible to use ctrl+z in bash script to send lftp process to background? also here is the script that generates lftp commands: FTPFILES1='/data1/cronJobs/ftpfiles.sh' DBNAME=CUSTOMER ##ftp files cd /data1/cronJobs/ cat /dev/null > ftpfiles.sh echo "lftp -u $FTPUSER,$FTPPASSWD $FTPSRV > $FTPFILES1 BACKUP_FILE_ARRAY=( /data*/"${DBNAME,,}"Backup/"$DBNAME.0.DBPART000".$(date +%Y%m%d)* ) for BACKUP_FILE in "${BACKUP_FILE_ARRAY[@]}" do echo "lcd $(dirname $BACKUP_FILE)" >> $FTPFILES1 echo "put $(basename $BACKUP_FILE)" >> $FTPFILES1 done echo "quit end_script exit 0 " >> $FTPFILES1
Asked by BlackCrystal (786 rep)
Jul 5, 2022, 05:12 AM
Last activity: Jul 5, 2022, 05:56 AM