Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pausing and resuming a Bash script

Tags:

bash

Is there a way to pause a Bash script, then resume it another time, such as after the computer has been rebooted?

like image 857
Village Avatar asked Apr 27 '26 11:04

Village


1 Answers

The only way to do that AFAIK:

  1. Save any variables, or other script context information in a temporary file to establish the state of the script just before the pause. This goes without saying that the script should include a mechanism to check this file to know if the previous execution was paused and, if it was, fetch all the context and resume accordingly.
  2. After reboot, manually run the script again, OR, have the script automatically run from your startup profile script.
like image 80
torrential coding Avatar answered Apr 30 '26 06:04

torrential coding



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!