I have a Shell Script (.sh) and need to automate it. Could someone help me ??
This script, copies data from a folder and sticks (converting to another format) into another directory, runs a Python script for plotting data, and updates the information obtained on a webpage.
To copy and paste files from one folder to another, the script reads the file name, which contains the date entered, and executes the other commands from there.
The data to be copied is two days ago (since I do not have data available for the last 24h)
The problem is that I need to manually change the date, every day.
I need to find a way to automate this process so that I do not have to manually update this date.
I need the script in addition to updating the date automatically, also rotate at a certain time of day and I get an error message if I can not find data in the folder to be copied.
I'm new to programming and so I'm having a hard time finding the best way to do that.
Here is the code I'm using:
!/bin/bash
date="2017-11-17"
year='date +"%Y"'
previous_year='date +"%Y" -d "-1 year"'
h4=/mnt/raid/CALIPSO/SCRIPTS/
dir=/mnt/raid/CALIPSO/DATA/NETCDF_TEMP/
cd /mnt/raid/CALIPSO/DATA/L1.5/2017/
cp CAL_LID_L15_Exp-Beta-V3-40.${date}T*.hdf /mnt/raid/CALIPSO/DATA/NETCDF_TEMP
for i in ${dir}*.hdf; do ${h4}h4tonccf_nc4 $i; done
python ${h4}CalipsoLatLonTimeLoop_TimTrack.py
#Uploading the data to WEB server
rsync -u -z -v -e "ssh -p 8222" /mnt/raid/CALIPSO/PICS/${year}* [email protected]:/home/www/html/rt/PICS/${year}/
rsync -u -z -v -e "ssh -p 8222" /mnt/raid/CALIPSO/PICS/${previous_year}* [email protected]:/home/www/html/rt/PICS/${previous_year}/