Search code examples
ubuntuserverstartupubuntu-16.04upstart

Ubuntu 16.04 | Upstart killing my process right after it starts


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!


Solution

  • 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.)