elective-stereophonic
elective-stereophonic
Command line arguments documentation
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.12.2

Author Topic: Command line arguments documentation  (Read 2388 times)

Brangdon

  • Hero Member
  • *****
  • Karma: +229/-25
  • Offline Offline
  • Posts: 1389
  • Quality is addictive.
    • View Profile
Command line arguments documentation
« on: March 14, 2016, 01:06:16 pm »

Is there any documentation for the NRS commandline arguments? For example, the Wiki has this line:

Code: [Select]
/usr/bin/java -Xmx1024M -cp nxt.jar;lib/*;conf nxt.Nxt STOP.PORT=11111 STOP.KEY=123456 --stop
I know the first few arguments go to Java, and -Xmx limits the memory and -cp sets the class path. nxt.Nxt is the name of the class to run. I know the remaining arguments go to NRS.

STOP.PORT and STOP.KEY seem to be documented on the French version of this page, but I don't read French and the English version has different content. Shouldn't the content be the same across all languages? I'm surprised to see magic numbers 11111 and 123456  and I am wondering if they are configured somewhere, but I don't see them in nxt-default.properties.

Are there any other arguments that can be passed?

One thing I am considering is to run testnet and mainnet from the same directory. It looks like I can achieve that by using a script that replaces "conf" with "testconf" and putting the testnet configuration there. I believe NRS will then switch to the testnet database automatically. Is this the recommended way?

Another thing I would like to do is start forging automatically. I've managed this in the past by using wget, but that's clumsy, especially as NRS has to be running for some few seconds before the API becomes available. Is there a command line argument that will execute API requests, such as "requestType=startForging&secretPhrase=secret", as soon as the API is available?
Logged

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Command line arguments documentation
« Reply #1 on: March 15, 2016, 11:23:44 am »

No command line arguments are supported. Those STOP.PORT and STOP.KEY are for versions before 0.8, way obsolete. Some system properties that can be defined on the java command line are used, -Dnxt.runtime.mode=desktop to run in desktop mode, -Dnxt.runtime.mode=service to run as a windows service.

If you want to run two instances from within the same directory, using different classpaths to specify different conf directories may work, also need to make sure logs and databases directories are different. But why not just have two separate installations in separate directories.

There will be a way to call scripts after the server has started in the next release, but you would have to write such script that still uses wget or curl, or write some custom java code to call the API internally.
Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322

Brangdon

  • Hero Member
  • *****
  • Karma: +229/-25
  • Offline Offline
  • Posts: 1389
  • Quality is addictive.
    • View Profile
Re: Command line arguments documentation
« Reply #2 on: March 15, 2016, 07:51:59 pm »

Thanks. The main reason to not have two directories is the extra work of updating them both when anything changes.
« Last Edit: March 15, 2016, 08:42:41 pm by Brangdon »
Logged

ScripterRon

  • Hero Member
  • *****
  • Karma: +75/-2
  • Offline Offline
  • Posts: 523
    • View Profile
Re: Command line arguments documentation
« Reply #3 on: March 26, 2016, 12:49:47 pm »

Thanks. The main reason to not have two directories is the extra work of updating them both when anything changes.
I run both mainnet and testnet servers on the same system.  I have two directories but use symbolic links from the testnet directory to the mainnet directory for the classes, html and lib subdirectories.  Within the conf directory, I use symbolic links for the nxt-default.properties and logging-default.properties files.  Shell scripts are used to start and stop the NRS servers.  I also use a shell script to start forging.  I haven't bothered to automate the forging script, but it could be done by having the script periodically check the log file to see if the server has completed initialization (I just check it manually before starting forging).
Logged
 

elective-stereophonic
elective-stereophonic
assembly
assembly