take config file via cmd line
This commit is contained in:
parent
24094cad31
commit
9606a755d0
1 changed files with 7 additions and 6 deletions
13
backup.nix
13
backup.nix
|
@ -23,11 +23,12 @@ let
|
||||||
mktemp
|
mktemp
|
||||||
];
|
];
|
||||||
|
|
||||||
excludeShellChecks = [ "SC1091" ];
|
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
bucket="$(cat "${backupConfigFile}" | grep 'bucket=' | sed 's/bucket \?= \?')"
|
configFile="$1"
|
||||||
prefix="$(cat "${backupConfigFile}" | grep 'prefix=' | sed 's/prefix \?= \?')"
|
s3cfg="$2"
|
||||||
|
|
||||||
|
bucket="$(cat "$configFile" | grep 'bucket=' | sed 's/bucket \?= \?')"
|
||||||
|
prefix="$(cat "$configFile" | grep 'prefix=' | sed 's/prefix \?= \?')"
|
||||||
|
|
||||||
s3Dir="s3://$bucket/\$\{prefix}misskey-$(date --iso-8601)"
|
s3Dir="s3://$bucket/\$\{prefix}misskey-$(date --iso-8601)"
|
||||||
echo "Uploading backups to '$s3Dir'"
|
echo "Uploading backups to '$s3Dir'"
|
||||||
|
@ -35,7 +36,7 @@ let
|
||||||
function upload () {
|
function upload () {
|
||||||
name="$1"
|
name="$1"
|
||||||
|
|
||||||
s3cmd put --config "${s3Cfg}" - "$s3Dir/$name"
|
s3cmd put --config "$s3cfg" - "$s3Dir/$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Uploading config"
|
echo "Uploading config"
|
||||||
|
@ -62,7 +63,7 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
systemCronJobs = [
|
systemCronJobs = [
|
||||||
# run every monday at ass in the morning, EST"
|
# run every monday at ass in the morning, EST"
|
||||||
"0 8 0 0 1 ${user} ${backupScript}"
|
"0 8 0 0 1 ${user} ${backupScript} ${backupConfigFile} ${s3Cfg}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue