3

If I run a background program (runs for 3 days) on a Linux server, and whilst it is running the server goes down for an hour, after that hour (when the server is up again) will my program resume running? or will be terminated due to the server going down whilst its execution?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • 1
    Does "go down" mean being shut down completely or just (for example) disconnected from the network? – Wieland May 18 '16 at 18:32
  • 1
    Or do you mean the server has suspended (power saving) when you write that the server is down? – ph0t0nix May 18 '16 at 18:44
  • Whether or not a program continues running on system restart is largely dependent on both program and system configuration, and how that is done on whether the program is a system service (i.e. registered with rc.d, Upstart, or systemd) or not. You may also want to look into the @reboot directive in cron. – Jules May 18 '16 at 18:51

1 Answers1

3

When a server goes down, this typically means that it does either poweroff or at least reboots. Servers normally do not go in standby mode like you would configure on your laptop.

If the server goes down, your program stops and doesn't continue unless the server is suspended (which is unlikely). For long running processes it is best to design them so that they save intermediate states/results on a regular basis (e.g. every ten minutes) and are capable of continuing with the last saved data when restarted.

Anthon
  • 79,293