installieren von ipfs als deamon
This commit is contained in:
commit
cdf1e4eed3
70
ipfs.initd
Normal file
70
ipfs.initd
Normal file
@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ipfs
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog $named
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: starts the ipfs daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/local/bin/ipfs
|
||||
IPFS_UID=1001
|
||||
IPFS_GID=1001
|
||||
IPFS_PID_FILE=/var/run/ipfs.pid
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
|
||||
ipfs_start() {
|
||||
if start-stop-daemon --start --quiet --background \
|
||||
--pidfile $IPFS_PID_FILE --make-pidfile \
|
||||
--chuid $IPFS_UID:$IPFS_GID --exec $DAEMON -- daemon
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
rm -f $IPFS_PID_FILE
|
||||
fi
|
||||
} # ipfs_start
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -s $IPFS_PID_FILE ] && kill -0 $(cat $IPFS_PID_FILE) >/dev/null 2>&1; then
|
||||
log_progress_msg "apparently already running"
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
log_daemon_msg "Startin ipfs daemon" "ipfs"
|
||||
ipfs_start
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping ipfs daemon" "ipfs"
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $IPFS_PID_FILE
|
||||
log_end_msg $?
|
||||
rm -f $IPFS_PID_FILE
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting rsync daemon" "ipfs"
|
||||
if [ -s $IPFS_PID_FILE ] && kill -0 $(cat $IPFS_PID_FILE) >/dev/null 2>&1; then
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $IPFS_PID_FILE || true
|
||||
sleep 1
|
||||
else
|
||||
log_warning_msg "ipfs daemon not running, attempting to start."
|
||||
rm -f $IPFS_PID_FILE
|
||||
fi
|
||||
ipfs_start
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $IPFS_PID_FILE "$DAEMON" ipfs
|
||||
exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/ipfs {start|stop|restart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
27
setup-ipfs-daemon
Normal file
27
setup-ipfs-daemon
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
## daemon user
|
||||
|
||||
#adduser ipfs -nologin -home /var/spool/ipfs/
|
||||
#GID=`id -g ipfs`
|
||||
#UID=`id -u ipfs`
|
||||
|
||||
|
||||
## init skript
|
||||
|
||||
cp ipfs.initd /etc/init.d/ipfs
|
||||
#sed -i 's/IPFS_GID=1001/IPFS_GID=$GID/g'
|
||||
#sed -i 's/IPFS_UID=1001/IPFS_UID=$GID/g'
|
||||
update-rc.d ipfs defaults
|
||||
|
||||
|
||||
## install ipfs
|
||||
|
||||
# wget ipfs_go_{arch}_{vers}.tar.gz
|
||||
# tar xzf ipfs_go_{arch}_{vers}.tar.gz
|
||||
# rm ipfs_go_{arch}_{vers}.tar.gz
|
||||
# ./go-ipfs/install.sh
|
||||
# chmod 770 `whereis -b ipfs | cut -d ":" -f 1`
|
||||
# chown ipfs:ipfs `whereis -b ipfs | cut -d ":" -f 1`
|
||||
|
||||
|
||||
service ipfs start
|
Loading…
Reference in New Issue
Block a user