I need a simple bash-script what does the following:
1) There is a path [TARGET] on the local file system defined as a variable at the beginning of the script.
2) It creates a directory (name = current date YYYY-MM-DD) within the [TARGET].
3) It downloads (curl) two (or more) files from different remote locations. The locations are https://... with basic htaccess auth and puts those files in [TARGET]/[CURDATE] . The complete URL, username and password can be hardcoded inside the script. Please write a function so I can add more locations on my own.
4) It establishes an open-vpn connection ([login to view URL], [login to view URL] files are in the same directory as the script is, username and password are given and can be hardcoded in the script)
5) It does the same as in 2) for another remote file which is only accessible over the vpn connection (https://192.168....)
6) It has to sync a remote directory which is also only accessible over the vpn connection (by FTP connection). The content of the directory is quite big (10GB) with few changes, the files should be stored in a tmp directory on the local machine. The sync is ONE WAY from the remote directory -> local directory. All the files deleted in the remote directory should be deleted in the local directory. Not other way around.
7) After the sync it should zip all the files inside the tmp directory from 6) and put the zipped file in the [TARGET]/[CURDATE]
8) disconnect from open vpn
9) If it is SATURDAY OR the 1. of the month it should download another remote file like in 2)
10) All directories older than 14 days created in [TARGET] should be deleted EXPECT of all directories created on the 1. of the month.
11) The script should send an email by SMTP (over TLS, receiver, server, username and password can be hardcored) with the following content: Every file in [TARGET]/[CURDATE] with its file size: [login to view URL] ... 2048KB ... [login to view URL] ....1024KB...
12) If it is the first of the month the directory created ([TARGET]/[CURDATE]) with all files in it should be uploaded to another target (by SFTP)
13) Thats it :-)
Unfourtunately I can not grant you access to the local server or to the remote file locations so you have to test the script on your machine. Please list all the dependencies / programs that I have to install on the local machine by apt-get. The local system is ubuntu 20 LTS. I am a software developer (with poor linux console skills) and can make some small modifications and adjust the script. I just need the complete working script (tested in your environment) ASAP and put in all the locations, usernames and so on.
PLEASE: Read the instructions carefully. All of the steps from 1) to 13) has to be done in this order. After the end of the script the openvpn connection must be terminated.
15 freelancers are bidding on average €132 for this job
Hello, I have experience in bash/shell script (Linux, CentOS, Ubuntu,...). I think your requirement is the same with my day work. I can do that for you, Thanks