-
Notifications
You must be signed in to change notification settings - Fork 36
/
scale-down.sh
executable file
·41 lines (35 loc) · 1.49 KB
/
scale-down.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
##############################################################
### _ _ _ ###
### __ _ __| |___ _ _ __| |_ _(_)__ _ ###
### / _` / _| / _ \ || / _` | '_| / _` | ###
### \__, \__|_\___/\_,_\__,_|_| |_\__, | ###
### |___/ |___/ ###
### ###
### scale-down.sh ###
### ###
### invoking this script will scale the instance-group ###
### created during setup to 0, effectively shutting down ###
### your rig. once that's done, it packs away the boot ###
### disk and games disk into cheaper storage. ###
### ###
##############################################################
# bash "what directory am i" dance
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# shellcheck source=./globals.sh
source "$DIR/globals.sh"
##############################################################
init_gcloudrig;
# shut it down
gcloudrig_stop
# save boot image
gcloudrig_boot_disk_to_image &
# save games snapshot
gcloudrig_games_disk_to_snapshot &
wait