ipfs_daemon/remove

23 lines
652 B
Bash
Executable File

#!/bin/bash
# Licence GPL 3
[ "`id -u`" != "0" ] && { echo run as root; exit 1; }
############################
## if daemon skript exist ##
############################
[ -f /etc/init.d/ipfs ] &&{
DAEMON=`cat /etc/init.d/ipfs | grep DAEMON= | sed 's/DAEMON=//g'`
IPFS_PID_FILE=`cat /etc/init.d/ipfs | grep IPFS_PID_FILE= | sed 's/IPFS_PID_FILE=//g'`
IPFS_UID=`cat /etc/init.d/ipfs | grep IPFS_UID= | sed 's/IPFS_UID=//g'`
IPFS_User=`id $IPFS_UID | cut -d "(" -f 2 | cut -d ")" -f 1`
[ -f "$DAEMON" ] && rm "$DAEMON"
[ -f "$IPFS_PID_FILE" ] && rm "$DAEMON"
sudo deluser $IPFS_User
update-rc.d -f ipfs remove
rm /etc/init.d/ipfs
}