LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Occured broken file that after download on my linux system (https://www.linuxquestions.org/questions/linux-software-2/occured-broken-file-that-after-download-on-my-linux-system-4175606560/)

poplinux 05-24-2017 01:24 AM

Occured broken file that after download on my linux system
 
Dear Sir.

Some times occured the broken file on my linux system.

Filesystem is FAT16. I already know that FAT16 is very BAD choice. but I must use the FAT16.

My procedure is see below.

step 1. download My own file from my ftp server.
step 2. execute "sysc" command
step 3. execute "reboot -f"


Code:

#!/bin/sh

wget ftp://ID:PW@MY_FTP/my_file.bin
sync
reboot -f

What occured this situation?
And How to recover this situation?

Thank you.

pan64 05-24-2017 05:26 AM

what I can imagine: you need to check if wget was really successful.

michaelk 05-24-2017 05:45 AM

I assume by broken file you mean the download failed. Could be many reasons and impossible for us to say. How often does this happen?

You can check the return status of wget to see if there is an error code. If the status is always zero even with a bad download there could be a network or server problem. If possible maybe add a checksum file to verify the download file is good. If either status or checksum verification fails then quit the script without rebooting. You could also automatically retry the download and quit after a set number.

poplinux 05-24-2017 11:27 PM

Quote:

Originally Posted by pan64 (Post 5714577)
what I can imagine: you need to check if wget was really successful.

Download is OK. I was check the download file using sha1 check.

poplinux 05-24-2017 11:27 PM

Quote:

Originally Posted by michaelk (Post 5714582)
I assume by broken file you mean the download failed. Could be many reasons and impossible for us to say. How often does this happen?

You can check the return status of wget to see if there is an error code. If the status is always zero even with a bad download there could be a network or server problem. If possible maybe add a checksum file to verify the download file is good. If either status or checksum verification fails then quit the script without rebooting. You could also automatically retry the download and quit after a set number.


Download is OK. I was check the download file using sha1 check.

pan64 05-25-2017 02:22 AM

you do not need to post the same answer twice....
how did you check the file is broken?

poplinux 05-25-2017 05:29 AM

Quote:

Originally Posted by pan64 (Post 5714915)
you do not need to post the same answer twice....
how did you check the file is broken?

Use the sha1 sum.

My file is have a sha1 sum.

pan64 05-25-2017 05:56 AM

so do you mean the sha1 sum was different before and after reboot?

ondoho 05-25-2017 02:41 PM

Quote:

Originally Posted by poplinux (Post 5714966)
My file is have a sha1 sum.

every file has a sha1 sum.
that in itself doesn't mean anything.
it's only meaningful if the sha1sum is the same as the one provided by the server that provided the download.

poplinux 05-26-2017 03:47 AM

Quote:

Originally Posted by pan64 (Post 5714973)
so do you mean the sha1 sum was different before and after reboot?

Yes. is different before and after.


All times are GMT -5. The time now is 11:32 PM.