2

I'm trying to run the binary monerod right on startup and it runs but gets killed right after.

Upstart .conf code:

start on started [redis]
stop on shutdown
script
        exec /home/crypto/daemon/monerod
end script

pre-stop script
        echo /var/log/upstart/monerod.log >> /home/crypto/monero.log
end script

monerod.log from /var/log/upstart :

^[[0m^[[1;37m2016-Oct-04 18:38:52.388997 Loading precomputed blocks: 1138751
^[[0m^[[1;32m2016-Oct-04 18:38:52.443751 Blockchain initialized. last block: 0,$
^[[0m^[[1;37m2016-Oct-04 18:38:52.659898 Core initialized OK
^[[0m^[[1;37m2016-Oct-04 18:38:52.660009 Starting core rpc server...
^[[0m^[[1;37m2016-Oct-04 18:38:52.660192 Run net_service loop( 2 threads)...
^[[0m^[[1;37m2016-Oct-04 18:38:52.660551 [SRV_MAIN]Core rpc server started ok
^[[0m^[[1;37m2016-Oct-04 18:38:52.660875 [SRV_MAIN]Starting p2p net loop...
^[[0m^[[1;37m2016-Oct-04 18:38:52.661142 [SRV_MAIN]Run net_service loop( 10 thr$
^[[0m^[[1;37m2016-Oct-04 18:38:52.661169 [node] Stop signal sent
^[[0m^[[1;37m2016-Oct-04 18:38:52.661197 [SRV_MAIN]net_service loop stopped.
^[[0m^[[1;37m2016-Oct-04 18:38:52.661465 [SRV_MAIN]p2p net loop stopped
^[[0m^[[1;37m2016-Oct-04 18:38:52.661512 [SRV_MAIN]Stopping core rpc server...
^[[0m^[[1;37m2016-Oct-04 18:38:52.661690 [SRV_MAIN]Node stopped.
^[[0m^[[1;37m2016-Oct-04 18:38:52.661735 [SRV_MAIN]Deinitializing rpc server...
^[[0m^[[1;37m2016-Oct-04 18:38:52.661969 [SRV_MAIN]Deinitializing p2p...
^[[0m^[[1;37m2016-Oct-04 18:38:52.662407 [SRV_MAIN]Deinitializing core...
^[[0m^[[1;37m2016-Oct-04 18:38:52.662600 [SRV_MAIN]Closing IO Service.
^[[0m^[[1;37m2016-Oct-04 18:38:52.663436 [SRV_MAIN]Deinitializing cryptonote_pr$
^[[0mCreating the logger system

As you can see somehow the script gets terminated @ "[node]: stop signal sent". The script runs fine when I run it manually and also when I run it from a shell that executes the program, it's only when I use it as a service that it doesn't work.

I've also diagnosed the CPu and RAM usage during the short while that the service actually runs using DSAT and it's ~1% on both, so there's no shortage of hardware.

Server specs: 2GB ram & 2CPU cores (DigitalOcean)

Any help would be greatly appreciated!

D. W
  • 25
  • 5
  • I don't know the binary that you are trying to run, but a common reason in these cases is that it is running as a different user each time. Are you sure you are trying to run it with the same user ? – Akis Oct 05 '16 at 20:39
  • It's running on startup so I assume it's running under the root user. – D. W Oct 06 '16 at 13:47
  • Since you run it as root and complete successfully, i would check if this binary needs other services running (another common startup failure) and config it (`http://askubuntu.com/questions/21378/how-can-i-make-sure-one-upstart-job-starts-before-other-upstart-jobs` ) to start after them. – Akis Oct 06 '16 at 16:59

2 Answers2

1

You are running monerod in interactive mode, which will terminate when standard input is /dev/null. You can fix this by adding --non-interactive. (You may also want to examine the --detach option.)

Ashley Yakeley
  • 664
  • 4
  • 11
0

The link from ubuntu wiki compares Upstart and systemd and workaround to fix issues related to Upstart and systemd, systemd was introduced as from Ubuntu 15.04 and later versions

George Otieno
  • 536
  • 4
  • 10