Best way to keep daemon alive on linux

Hi people, I’m building an app using IPFS for decentralized storage, but right now I only have 1 node, which is running on ubuntu on AWS.

The daemon won’t stay alive for long periods of time, and I can’t figure out why (aside: can anyone recommend how to do logging properly to find these issues). Regardless, I need to do something to keep the daemon alive if it dies.

I’m currently trying out systemd with the following service in /etc/systemd/user:


ExecStart=/usr/local/bin/ipfs daemon


However, I find that the daemon still stops working and I have to manually ssh and do a “ipfs daemon” command.

What can I do to make sure my users will experience the least downtime?

Thank you

Try looking at the logs via journalctl, you can do it like this: journalctl --unit ipfs but replace ipfs with the name of your unit.

We’re running IPFS via systemctl and AWS for Jenkins archiving, and the daemon runs fine. First place to look for issues is the logs. If there is nothing in the ipfs-logs, try looking at the system logs, and see if maybe the OOM-killer is killing IPFS. If so, you might need to configure IPFS to use less connections or get more memory.

Thanks! I will investigate.

@JoseMiguelHerrera This is how I’ve been using it with systemd:

Just replace {{ipfs_path}} with the path to your IPFS directory (eg.: /home/my-username/.ipfs) and you should be good to go.


Another way to run the daemon: Systemd service to maintain IPFS daemon on low-end system

Thanks for this answer, It will help me also.