qusal/salt/sys-bitcoin/files/server/bin/bitcoin-dbcache
Ben Grande 1b2f1ba941
fix: avoid operand evaluation as argument
Explicit end option parsing as the shell can be quite dangerous without
it.
2024-08-06 17:13:25 +02:00

12 lines
349 B
Bash
Executable File

#!/bin/sh
## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
##
## SPDX-License-Identifier: AGPL-3.0-or-later
set -eu
conf="${HOME}/.bitcoin/conf.d/dbcache.conf"
cache_Mi="$(awk -- '/^MemTotal:/{printf "%.0f", $2/1024}' /proc/meminfo)"
cache="$((cache_Mi*75/100))"
echo "dbcache=${cache}" | tee -- "${conf}" >/dev/null