Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkg20001/ipfs-node-restart
Reconnects/Restarts your node if you are offline
https://github.com/mkg20001/ipfs-node-restart
bash ipfs nodejs restart-script
Last synced: about 2 months ago
JSON representation
Reconnects/Restarts your node if you are offline
- Host: GitHub
- URL: https://github.com/mkg20001/ipfs-node-restart
- Owner: mkg20001
- License: gpl-3.0
- Created: 2016-09-05T13:47:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-03T08:12:20.000Z (almost 4 years ago)
- Last Synced: 2024-12-03T14:05:58.757Z (about 2 months ago)
- Topics: bash, ipfs, nodejs, restart-script
- Language: JavaScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipfs-reconnect
Reconnects/Restarts your node automatically if you are offline.# Usage
```
Options:
-i, --interval Scan Interval [number] [default: 1000]
-b, --binary Path to IPFS binary [string] [default: "ipfs"]
-r, --restart Allow restart [boolean] [default: false]
-s, --restart-script Path to restart script [string] [default: ""]
-m, --min-nodes Minimum nodes online [number] [default: 4]
-p, --path Path to IPFS repo [string] [default: "/home/user/.ipfs"]
-h, --help Show help [boolean]Copyright (C) 2015 Maciej Krüger
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```# Restart Script
Start the IPFS Daemon as background - the application will wait for the script to exit
#### Example Script (with ```screen```):
```
SCREEN="ipfs"
screen -X -S $SCREEN quit 2> /dev/null > /dev/null #kill if running
waitforstop() {
screen -S $SCREEN -X alive 2> /dev/null > /dev/null
if [ $? -eq 0 ]; then
echo -n "."
sleep .25s
waitforstop $1
else
sleep .5s
fi
}
if [ $? -eq 0 ]; then
echo -n "stopping..."
waitforstop $SCREEN
echo "ok"
fi
which ipfs 2> /dev/null > /dev/null
if ! [ $? -eq 0 ]; then export PATH="/usr/local/bin/:$PATH"; fi #fix missing PATH location
echo -n "restarting..."
screen -dmS $SCREEN ipfs daemon #start
waitfor() {
screen -S $SCREEN -X alive 2> /dev/null > /dev/null
if [ $? -ne 0 ]; then
echo "failed!"
exit 2
fi
curl $1 --connect-timeout 1 -m 1 -s 2>/dev/null > /dev/null #try to load webui
if [ $? -ne 0 ]; then
echo -n "."
sleep .25s
waitfor $1
else
echo "ok"
exit 0
fi
}
waitfor "localhost:5001/webui"
```