If I run incremental backups with rsync from the .bash_logout files, when will the backup complete its work? Before logout or after?
1 Answers
The ~/.bash_logout script is sourced when you exit a login shell. If you are running a graphical system, then depending on your login manager, you might be starting a new login shell when you log in, in which case, you will run the commands in ~/.bash_logout when you log out.
If you have long running commands there, that will cause everything to wait until they have finished. I tested this by simply adding sleep 30 to my ~/.bash_logout, then starting a login shell with bash -l and exiting it with exit. The shell waited 30 seconds before closing.
So yes, you could add your backup options there, just test it first to be sure that your system does actually look at ~/.bash_logout when logging out. Assuming it does, then the system should start the backup process when you log out and then wait for your backup to finish before fully logging our or shutting down.
- 104,119