Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Raspberry Pi which I want to use to automate downloads to a network drive. I would like to restart the machine on a regular basis using cron (I've heard they're not the most stable of things) but obviously, I would prefer not to restart it half way through an incomplete download.

I'll probably be downloading using several different methods but one of the ways I'll be using soon is get_iplayer and probably basic wget stuff too.

Is there a way I can check if one is in progress?

Any advice appreciated.

share|improve this question
    
Could you add information about the download process you are implementing? –  Aurelien Jan 17 '13 at 12:39
    
I've added a bit more info. –  Dan Jan 17 '13 at 12:43
    
If your system is unstable, find out why. To me Linux generally has been rock solid. Reasons of instability include hardware problems (RAM, CPU fan not working leads to overheating, machine is sensible to voltage fluctuations, network/other cables near electromagnetic interference sources like fluorescent lights of electric motors) or software glitches (trouble with the driver of some card), and sometimes miscreants beating on the system (like the infamous SSH brute force login testers). –  vonbrand Jan 21 '13 at 19:14

1 Answer 1

up vote 2 down vote accepted

Some dirty ideas :

  • Poll running software using ps : if a wget instance is running, then do not reboot.
  • Create a lock file when triggering a download, and poll the lock file

Anyway, wget -c allow to continue an interrupted download.

share|improve this answer
    
I second the lock file idea. Basically, just touch a file in /tmp or something right before calling wget, and delete that file after the wget call. If this file exists, don't reboot. –  Banjer Jan 17 '13 at 13:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.