diff options
| author | Slack Coder <slackcoder@server.ky> | 2025-08-26 16:07:00 -0500 |
|---|---|---|
| committer | Slack Coder <slackcoder@server.ky> | 2025-09-04 04:55:00 -0500 |
| commit | f7c9b27b590ed1527d913e6083fa3aa2b7ab3ca7 (patch) | |
| tree | 55cf542918c3748231f006d7700d84c968c31d89 /bitcoin/file | |
| parent | 3f799ac48e925555c5a771558633675cf3819cdf (diff) | |
| download | slackbuilds-bitcoin.tar.xz | |
Add bitcoin: add rc.scriptbitcoin
Diffstat (limited to 'bitcoin/file')
| -rw-r--r-- | bitcoin/file/bitcoin-qt.desktop | 10 | ||||
| -rw-r--r-- | bitcoin/file/bitcoind.conf.new | 59 | ||||
| -rw-r--r-- | bitcoin/file/rc.bitcoind.new | 95 |
3 files changed, 164 insertions, 0 deletions
diff --git a/bitcoin/file/bitcoin-qt.desktop b/bitcoin/file/bitcoin-qt.desktop new file mode 100644 index 0000000..858ab28 --- /dev/null +++ b/bitcoin/file/bitcoin-qt.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Bitcoin-Core +GenericName=Bitcoin QT-Client +Comment=Bitcoin client to send and receive money +Exec=/usr/bin/bitcoin-qt +Icon=bitcoin +StartupNotify=true +Terminal=false +Type=Application +Categories=Network;P2P diff --git a/bitcoin/file/bitcoind.conf.new b/bitcoin/file/bitcoind.conf.new new file mode 100644 index 0000000..2189ba1 --- /dev/null +++ b/bitcoin/file/bitcoind.conf.new @@ -0,0 +1,59 @@ +# Data directory +datadir=/var/lib/bitcoind + +# <category> are: addrman, bench, blockstorage, cmpctblock, coindb, +# Output debug and trace logging (default: -nodebug, supplying <category> +# any other categories are ignored. Other valid values for +# estimatefee, http, i2p, ipc, leveldb, libevent, mempool, +# is optional). If <category> is not supplied or if <category> is 1 +# mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, scan, +# or "all", output all debug logging. If <category> is 0 or "none", +# output multiple categories. +# selectcoins, tor, txpackages, txreconciliation, validation, +# walletdb, zmq. This option can be specified multiple times to +debug=none + +# Specify location of debug log file. Relative paths will be prefixed by a +# net-specific datadir location. +debuglogfile=/var/log/bitcoind/bitcoind.log + +# pid file to track the running process. Relative paths will be prefixed by a +# net-specific datadir location. +pid=/run/bitcoind/bitcoind.pid + +# '1' tells Bitcoin to accept JSON-RPC commands so that your fullnode can be run as a server +server=1 + +# Accept connections from outside. +# listen=1 + +# Reduce storage requirements by enabling pruning (deleting) of old +# blocks. This allows the pruneblockchain RPC to be called to +# delete specific blocks and enables automatic pruning of old +# blocks if a target size in MiB is provided. This mode is +# incompatible with -txindex. Warning: Reverting this setting +# requires re-downloading the entire blockchain. (default: 0 = +# disable pruning blocks, 1 = allow manual pruning via RPC, >=550 = +# automatically prune block files to stay under the specified +# target size in MiB) +# prune=550 + +# Automatically create Tor onion service. +# listenonion=1 + +# How many seconds Bitcoin will wait for a complete RPC HTTP request +# after the HTTP connection is established. +rpctimeout=30 + +# By default, only RPC connections from localhost are allowed. Specify +# as many rpcallowip= settings as you like to allow connections from +# other hosts (and you may use * as a wildcard character): +#rpcallowip=10.1.1.* +#rpcallowip=192.168.1.* + +# Bind to given address to listen for JSON-RPC connections. Do not expose the +# RPC server to untrusted networks such as the public internet! This option is +# ignored unless -rpcallowip is also passed. Port is optional and overrides +# -rpcport. Use [host]:port notation for IPv6. This option can be specified +# multiple times (default: 127.0.0.1 and ::1 i.e., localhost) +# rpcbind=localhost:8332 diff --git a/bitcoin/file/rc.bitcoind.new b/bitcoin/file/rc.bitcoind.new new file mode 100644 index 0000000..288f39e --- /dev/null +++ b/bitcoin/file/rc.bitcoind.new @@ -0,0 +1,95 @@ +#!/bin/sh + +# Time to wait for Bitcoin to gracefully stop. +TIMEOUT=${TIMEOUT:-5000} + +create_bitcoind_run_dir() { + if [ ! -d /run/bitcoind/ ]; then + mkdir -p /run/bitcoind + chown bitcoin:bitcoin /run/bitcoind + fi +} + +bitcoind_start() { + create_bitcoind_run_dir + + echo -n "Starting Bitcoin daemon: " + + local pid="" + if [ -f /run/bitcoind/bitcoind.pid ] && ! pid=$(</run/bitcoind/bitcoind.pid); then + return + fi + + if [ ! -z "$pid" ] && /bin/kill -0 "$pid" >/dev/null; then + echo "already running" + + return + fi + + if ! daemon \ + --user bitcoin:bitcoin \ + -- \ + bitcoind \ + -conf=/etc/bitcoin/bitcoind.conf \ + -daemon=0; then + echo "failed" + else + echo "ok" + fi +} + +bitcoind_status() { + create_bitcoind_run_dir + + echo -n "Bitcoin daemon: " + + local pid="" + if [ -f /run/bitcoind/bitcoind.pid ] && ! pid=$(</run/bitcoind/bitcoind.pid); then + return + fi + + if [ ! -z "$pid" ] && /bin/kill -0 "$pid" 2>/dev/null; then + echo "running" + else + echo "not running" + fi +} + +bitcoind_stop() { + create_bitcoind_run_dir + + echo -n "Stopping Bitcoin daemon: " + + local pid="" + if [ -f /run/bitcoind/bitcoind.pid ] && ! pid=$(</run/bitcoind/bitcoind.pid); then + return + fi + + if [ -z "$pid" ] || ! /bin/kill -0 "$pid" 2>/dev/null; then + echo "not running" + + return + fi + + if /bin/kill --timeout "${TIMEOUT}" TERM "$pid"; then + echo "stopped" + else + /bin/kill KILL "$pid" + echo "killed" + fi +} + +case "$1" in +start) + bitcoind_start + ;; +status) + bitcoind_status + ;; +stop) + bitcoind_stop + ;; +*) + echo "Usage: $0 {start|status|stop}" + exit 1 +esac |
