I have the following problem. I have a bash script that uses wget to get a few files from the build server, and then scp's them over to the production system: Here is the relevant snippet:
#Several of these lines
wget -nv -O birt_reports.zip "http://buildserver:8111/guestAuth/repository/download/bt6/.lastFinished/birt_reports.zip"
#files in the for loop left out for simplicity
for upload_file in "birt_reports.zip"; do
scp -B -i /root/$keyfile $upload_file $user@gateway:/home/$user/deploy_staging
touch $upload_file
done
Even with the touch in there the time shown in ls -l of the directory is the time the file was first created. If I do the wget outside the bash script or the touch outside the bash script, the time updates correctly.
What could the issue be?
Using the bellow command it is supose to set the timestamp of the file to your system current datetime:
You could try it instead of the plain touch command alone.
Also when you run your bash script run with:
also try using the full path of your commands, to verify the full path of the command do:
whereis touch
Since you could be using this without a shell enviroment using the full path is more recommended to make sure it will run every command without problems.
perhaps
/bin/touch -m $upload_file
is better suited, as it changes the modification time to the current time.Is the file being properly scp'ed? (I can't comment on your question post)
If not, then I think you're missing something to the uploaded file path within the for loop for both commands. Prix points out the way to check the actual commands.