IPFS daemon Is keep getting killed

I am trying to create a service LIKE this using a VPS server.
In that I am running IPFS daemon using this command

ipfs daemon &

But after some time IPFS is getting killed what can I do about this?

You should create a service to run ipfs.

I have acually done it.Here is my ipfs service file.

> [Unit]
> Description=IPFS daemon
> After=network.target
> [Service]
> ### Uncomment the following line for custom ipfs datastore location
> # Environment=IPFS_PATH=/path/to/your/ipfs/datastore
> ExecStart=/snap/ipfs/current/ipfs  daemon --enable-gc
> Restart=always
> [Install]
> WantedBy=multi-user.target

After saving this I am aexcicuting the following commands.

sudo systemctl daemon-reload
sudo systemctl enable ipfs
sudo systemctl start ipfs

But I am not getting the ipfs on my server.

only the command

ipfs daemon &

Is making the files public.

Check the results of the command “which ipfs” and update the path you have listed in ExecStart if needed. Also, check the results of the command “systemctl status ipfs” for error messages.

If I were to guess, you have an IPFS repo initialized in your home directory ($HOME/.ipfs), but when run as a super user, it uses a different path (/root/.ipfs, if I remember correctly). If the status command above shows an error message about the repo not being initialized, try running “sudo ipfs init”, restarting the service and then checking “systemctl status ipfs” again.

1 Like

Yes its fixed the bug the path of the ipfs which i have listed on the service file was wrong.