I try to write a backup script, i want to create a backup tar.gz and then encrypt file automatic in bash script. Thanks for all help. You can see how i create a backup in the code below.
#t Backup Script
# Create Backup Archive
tar -cpzf $backupDir/$dateFormat-server.tar.gz $serverDir
Hi, I don’t understand what problem you are facing here. Does the bash script give some error or what?
No im looking for some help how i can create a file and encrypt it using bash script.
So my goal with this:
1 Create a backup file
2 encrypt the backup file
3 move the encrypted file to a backup server using sftp.
I didnt found any good soultion for this so i turned to stationx forum.
Thanks for your reply.
Do you want to take backup of a particular folder or entire machine? Anyway you can create backup file for any folder or file using cp by just copying it to another directory that you want to archive and encrypt. Just use a command like
cp <original_file> <backup_dir/backup_file> and then run your tar script to archive it and then to encrypt you can use something like gpg (https://devconnected.com/how-to-encrypt-file-on-linux)