How to config centos to start ipfs automatically?

From @beyonderyue on Wed Mar 01 2017 09:38:43 GMT+0000 (UTC)

I want start ipfs automatically after power on… but I met issues like belows:
The ipfs daemon start automatically, but after 1min, it is terminated.
Mar 01 10:52:27 acw5.localdomain ipfs[1373]: Swarm listening on /ip4/127.0.0.1/tcp/4001
Mar 01 10:52:27 acw5.localdomain ipfs[1373]: Swarm listening on /ip6/::1/tcp/4001
Mar 01 10:52:27 acw5.localdomain ipfs[1373]: API server listening on /ip4/0.0.0.0/tcp/5001
Mar 01 10:52:27 acw5.localdomain ipfs[1373]: Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8090
Mar 01 10:52:27 acw5.localdomain ipfs[1373]: Daemon is ready
Mar 01 10:53:55 acw5.localdomain systemd[1]: ipfs.service operation timed out. Terminating.
Mar 01 10:53:55 acw5.localdomain ipfs[1373]: Received interrupt signal, shutting down…
Mar 01 10:53:55 acw5.localdomain ipfs[1373]: (Hit ctrl-c again to force-shutdown the daemon.)
Mar 01 10:53:56 acw5.localdomain systemd[1]: Failed to start ipfs.
Mar 01 10:53:56 acw5.localdomain systemd[1]: Unit ipfs.service entered failed state.

Copied from original issue: https://github.com/ipfs/support/issues/52

From @whyrusleeping on Mon Mar 06 2017 05:44:44 GMT+0000 (UTC)

@beyonderyue what does your ipfs.service file look like?

From @beyonderyue on Mon Mar 06 2017 06:40:26 GMT+0000 (UTC)

@whyrusleeping
[Unit]
Description=ipfs
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/bin/ipfs daemon
ExecReload=
ExecStop=
PrivateTmp=true

[Install]
WantedBy=multi-user.target

From @Kubuxu on Mon Mar 06 2017 11:08:00 GMT+0000 (UTC)

@beyonderyue ipfs daemon does not fork. For sample good service file see: https://aur.archlinux.org/cgit/aur.git/tree/ipfs.service?h=go-ipfs-git