Start SFS with port number as argument

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Start SFS with port number as argument

Postby weberekt » 16 Feb 2015, 11:27

Is there a way to start smartfox instance with port number as argument?

We want to run multiple smartfox instances with different port number in a auto-scalable way.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Start SFS with port number as argument

Postby Lapo » 16 Feb 2015, 12:22

Hi,
short answer is no. You can't run multiple instances from the same folder by the way, because they would share the same log files, data files etc...

Best option is to clone the installation folder and reconfigure each instance with its own port settings.

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Start SFS with port number as argument

Postby weberekt » 16 Feb 2015, 21:45

haha thought so, but was hoping maybe there is a nicer way.

Thanks for the reply.
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Start SFS with port number as argument

Postby weberekt » 17 Feb 2015, 03:45

Hi Lapo,

I have successfully created a script to clone folder and modify the port numbers.

But Im facing another problem: How do I start multiple services?

I know the normal way is by ./sfs-service start, but what it starts is a server daemon which is allowed only one.

I tried sfs2x.sh, but one I close my connection, the server also ends.

Please help!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Start SFS with port number as argument

Postby Lapo » 17 Feb 2015, 10:48

Now I realize you're talking about SFS2X... but you've posted in the wrong section, so this will be moved.

Back to your question. You can use the sfs2x.sh script with nohup to make sure it keeps running when you close the terminal session.
http://www.computerhope.com/unix/unohup.htm

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Start SFS with port number as argument

Postby weberekt » 17 Feb 2015, 22:46

Sorry, I was actually asking about adding bluebox port as argument, so I put it into Bluebox section.

But my task is actually bigger than that, everything is inter-related, so it's pretty hard to put my question into a specific area. :)

Back to the topic, thanks for your help, I have managed to start all processes at once, and save there pid in a file.

The problem right now is that, the pid nohup returns is the shell script process, it doesn't include the pid of java process.

eg. command: ps -A
12140 ttys000 0:00.10 /bin/sh /Applications/SmartFoxServer_2X/SFS2X/sfs2x-standalone
12141 ttys000 0:00.10 /bin/sh /Applications/SmartFoxServer_2X_1/SFS2X/sfs2x-standalone
12423 ttys000 0:04.23 /Applications/SmartFoxServer_2X/.install4j/jre.bundle/Contents/Home/jre/bin/java -server -Dinstall4j.jvmDir=/Applications/SmartFoxServer_2X/.install4j/
12427 ttys000 0:04.16 /Applications/SmartFoxServer_2X/.install4j/jre.bundle/Contents/Home/jre/bin/java -server -Dinstall4j.jvmDir=/Applications/SmartFoxServer_2X/.install4j/

12140 and 12141 are the ones I know. How do I get the ids of the other two? or is there a proper way to do this?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Start SFS with port number as argument

Postby Lapo » 18 Feb 2015, 09:28

You can use the "jps" in the terminal to see the process ids of all java apps running.

NOTE: Jps is a utility bundled with the JDK. Depending on your OS you may have it already installed (e.g. OS X), otherwise you will need to install it in order to use the utility.

Alternatively you can search the pids via "ps", something like ps -ax |grep java

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Start SFS with port number as argument

Postby weberekt » 18 Feb 2015, 11:14

Thanks for the reply.

I actually managed to get around this by copying the code in sfs2x.sh/sfs2x-standalone into my own script.

Cheers

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 58 guests