can port of a cq instance be set in terminal - aem

their is an option for setting run mode of a CQ Instance directly in terminal
viz -Dsling.run.modes=${CQ_RUNMODE}
is their a similar option for changing the port as well.
I'm basically looking for a solution to keep changing name of CQ jar for a new instance.
Thanks

-p option can be used to set the port number from command line.
Ex: java -jar cq5-4502.jar -p 4503 will start the instance on 4503 even though the jar name contains 4502 as the port number.

Related

Sinatra not binding to right port

I'm using Openshift and Sinatra to host my website. But it's not binding to the right port.
set :port, ENV["OPENSHIFT_RUBY_PORT"]
set :port, ENV["OPENSHIFT_RUBY_IP"]
...
puts ENV["OPENSHIFT_RUBY_PORT"]
puts settings.port
puts ENV["OPENSHIFT_RUBY_IP"]
puts settings.bind
This returns the correct output. But when the server actually starts...
Listening on localhost:9292, CTRL+C to stop
The error:
no acceptor (port is in use or requires root privileges) (RuntimeError)
How do I get it to bind to the right port?
set :port, ... sets the port for Sinatra’s builtin server, but you are using rackup, so this setting is not used (9292 is the default port for Rack).
You can use the -p or --port options to rackup to set the port. From the command line you can do:
$ bundle exec rackup -p $OPENSHIFT_RUBY_PORT
You can also specify command line options in the first line of the config.ru, but I don’t think you can specify environment variables there.
If you want to avoid specifying the port on the command line, you may need to create a wrapper script that reads the environment variables and calls rackup.

How do I run livereload server on localhost after running Ionic serve command?

I recently started learning Ionic Framework. You can use Ionic serve command inside the project to run a livereload server. Once in a while it asked whether server should run on localhost or system ip. I chose second option. Now It doesn't ask anything and directly runs on system's ip.
How do reset this automatic behaviour?
I tried looking into serve.js file in ionic-cli project but no luck.
It's not necessary to edit the code. You can switch between addresses with the command ionic address. You'll then get options like this:
Please select which address to use by entering its number from the list below:
1) 10.0.1.7 (en1)
2) localhost
like #user3110357 points out you can just type ionic address command and you get the option to select your IP address again.
OR
you can explicitly select your address and port when you run ionic serve
by using the --address and --port options. Like this:
ionic serve --address IP_address --port port
example : ionic serve --address 192.168.1.129 --port 8101
Things to note
If you do not provide a port option with --address the default port(8100) is used instead.
Specifying address and port will only change the settings for that session. if you need to override saved settings, you should probably use the ionic address command instead.
Found a workaround. I am using this method on ubuntu so paths may be different for other os.
Go to /usr/lib/node_modules/ionic/lib/ionic
Open serve.js with root user.
Find function called IonicTask.prototype.getAddress
Inside this function the value of variable isAddressCmd is false. Set it to true
self.isAddressCmd = false;
save the file. Now run Ionic serve for your project. This time it will ask for localhost vs ip again.
After this remove the newly added code from serve.js otherwise ionic serve won't work.

Google App Engine Java on Eclipse can not connect to localhost

Usage: [options]
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=DIR Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
--generated_dir=DIR Set the directory where generated files are created.
--jvm_flag=FLAG Pass FLAG as a JVM argument. May be repeated to
supply multiple flags.
I had come across similar problem while working with Google App Engine for Python-loalhost was not getting its connection established.
$fuser -k 8080/tcp
Try this in terminal/command prompt and restart localhost.
It worked for me. Hope it works for you also. Good luck!

Postgres.app configuration (port and other options)

I just installed Postgres.app on my Mac, and I need to make some specific configuration to server. For example I want to use different port, not 5432.
I found that it have postgresql.conf at ~/Library/Application\ Support/Postgres/var/postgresql.conf, but even if I change value of port = to something other, it listen on 5432 after server restart.
Seems that this postgresql.conf isn't used by Postgress.app. Where it stores server configuration files?
The postgresql.conf-file at ~/Library/Application\ Support/Postgres/var/ is used by Postgres.app. The only problem: if you change the port in that file, that change will not be reflected in the menu-bar. So the elephant over there will still say "Running on Port 5432", although postgres might be running on, for example, port 5433. (Mac OS X 10.8.2, Server.app 2.2, Postgres.app 9.2.2.0)
I can see the output from ps aux |grep post
/Applications/Postgres.app/Contents/MacOS/bin/postgres -D /Users/chenc26/Library/Application Support/Postgres/var -p5432
So I think there must be some config in this app to specify the CLI parameter which ignore the value from config file.
I'm running a Mavericks 10.9.3 and opening Postgres app v9.3 config via nano ~/Library/Application\ Support/Postgres/var-9.3/postgresql.conf and uncommenting the port = 5432 line, then changing it to, say, 5433 did the trick for me. (Restarting the app was required, as the config file mentions). Afterwards the app correctly displays that it is running on port 5433.
If correctly changing the content of postgresql.conf, then restarting the PostgreSQL server doesn't change the port it's listening on, you're almost certainly editing the wrong postgresql.conf.
On other platforms, PostgreSQL puts a copy of its default version of postgresql.conf in the data directory. So you're liable to find at least two copies of all the configuration files somewhere on your computer--usually one in the directory where the distribution or source was downloaded or uncompressed, and one in the data directory. On your Mac, if you're using version 9.1, the data directory might be
/Library/PostgreSQL/9.1/data/
Check for a postgresql.conf there. If you find one, consider making a copy of it to replace the one you edited. (So the one you edited will again be an unedited version.)
In 2022, I can't just edit the server.conf file. It looks like instead, I've had to do this from the GUI to change the port which the command line parameters refer to:
... bin/postgres -D /Users/MyUser/Library/Application Support/Postgres/var-11 -p 6543
The way I was able to make the change was to:
Open the Postgres elephant icon in the top bar.
Select "Open Postgres"
Stop the server.
Click on server settings.
Then, change the port in the simple input.
After this, start the server and find that the port has changed.
This works for the Postgres.app (version 11 on my desktop).

jboss-5.1.0.GA auto start on boot

I was given the task of installing jboss-5.1.0.GA on a remote ubuntu 10.4 Lts server. With all those resources out there I was able to run jboss successfully but my problem was that I wasn't able to get auto start on boot work so that jboss would be running on the server.
I followed a couple of tutorials that said me create a separate user called jboss and to copy the jboss_init_Redhat.sh to the /etc/init.d/jboss (jboss home, java path ,jboss user and the binding to 0.0.0.0 is all set) and used /etc/init.d/jboss start
but I can't get to see the Jboss page at the Ip on a browser.,
If i do a ./run.sh -b 0.0.0.0 ==> the server is up ...
Can some body shed some light on this issue????
If you want to run JBoss AS on given interface using jboss_init_redhat.sh script look at these line:
#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}
You should just define new variable before these line:
JBOSS_HOST="0.0.0.0"
You should also check shutdown command (especially when you run your server on some other address then 127.0.0.1 or 0.0.0.0), it should know how to find your server:
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown -s jnp://${JBOSS_HOST}:1099"}