Go to file
Heavybullets8 683e8b4d62
Safety Checks
1. Ensure number of backups is AT LEAST 1. Im assuming a value of 0 would be user error.. so we want to ensure we have at least one backup

2. Make restore function use the same sorting method. Which ignores all words, only uses the values. 

3. Changed mountpoint from `/temporary` to `/heavyscript`
Hopefully to avoid any issues of users using /temporary for ANY other reason..

4. Add a safety check within the unmount feature..
Before, there was a possibility users could have two applications, on separate pools, the script would try to mount to both of them. Obviously this is an issue.
So we added a newline count, if the find command finds more than one entry for an application, use the slower, but more reliable method of checking the users current application pool, attempt to mount the application instance that exists on that pool.

5. If user tries using '-r' and '-m' at the same time, report an error and exit. Those two functions cannot be used at the same time..
2022-05-12 04:28:27 +00:00
heavy_script.sh Safety Checks 2022-05-12 04:28:27 +00:00
LICENSE Initial commit 2022-04-21 21:18:27 +00:00
README.md Verbose information README 2022-05-12 01:15:28 +00:00

heavy_script

Update | Backup | Restore | Mount PVC | Rollback Applications | Sync Catalog | Prune Docker Images

Flag Example Parameter Description
-r -r None Restore HeavyScript specific 'ix-applications dataset' snapshot
-m -m None Initiates mounting feature
Choose between unmounting and mounting PVC data
-b -b 14 int Backup 'ix-appliactions' dataset
Creates backups up to the number you've chosen
-i -i nextcloud -i sonarr String Applications listed will be ignored during updating
-R -R None Monitors applications after they update
If the app does not become "ACTIVE" after either:
The custom Timeout, or Default Timeout,
rollback the application.
-v -v None Verbose output
-S -S None Shutdown applications prior to updating
-t -t 150 int Set a custom timeout to be used with either:
-m
- Time the script will wait for application to be "STOPPED"
or
-u/U
- Time the script will wait for application to be either "STOPPED" or "ACTIVE"
-s -s None Sync Catalog before updating
-U -U None Update applications, ignoring major version changes
-u -u None Update applications, do NOT update if there was a major version change
-p -p None Prune old/unused docker images


Examples

Typical Cron Job

bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -i radarr -t 600 -Rsup
  • -b is set to 14. Up to 14 snapshots of your ix-applications dataset will be saved
  • -i is set to ignore portainer, arch, sonarr, and radarr. These applications will be ignored when it comes to updates.
  • -t I set it to 600 seconds, this means the script will wait 600 seconds for the application to become ACTIVE before timing out and continuing to a different application.
  • -R Will rollback applications if they fail to deploy after updating.
  • -s will just sync the repositories, ensuring you are downloading the latest updates.
  • -u update applications as long as the major version has absolutely no change, if it does have a change it will ask the user to update manually.
  • -p Prune docker images.

Mounting PVC Data

bash /mnt/tank/scripts/heavy_script.sh -t 300 -m

Restoring ix-applications dataset

bash /mnt/tank/scripts/heavy_script/heavy_script.sh -r

My personal Cron Job

git -C /mnt/speed/scripts/heavy_script pull && bash /mnt/speed/scripts/heavy_script/heavy_script.sh -b 14 -Rsup


Additional Informaton

Verbose vs Non-Verbose

  • Verbose used bash heavy_test.sh -b 5 -SRupv
  • Non-Verbose used bash heavy_test.sh -b 5 -SRup
Verbose Non-Verbose
image image