create the file /etc/init/ipfs.conf, with the following contents:
description "ipfs-daemon"
author "Joe Bloggs"
start on started mountall
stop on shutdown
# automatically respawn
respawn
respawn limit 20 5
script
export IPFS_PATH="/root/.ipfs"
exec ipfs daemon >> /var/log/ipfs-daemon.log 2>&1
end script
post-start script
end script
- NB: remember to modify the path /root/.ipfs if this is not the location of your ipfs folder
- NB: the service logs to /var/log/ipfs-daemon.log - this is also configurable in the above file
- now you can run "sudo start ipfs" to start the service and "sudo stop ipfs" to stop the service