console output on start

Is there any way to customize the messages that display when start is used? I know the output can be piped or redirected, but where can I edit the message itself?

Thanks

Can you clarify, when you say “on start” do you mean when you use the “server start” command to start up a server or are you talking about the actual CommandBox ASCII art that appears when you first open the interactive shell?

If you just want to customize the ASCII art, check out this module which does exactly that:

https://www.forgebox.io/view/commandbox-banner-customizer

If you’re talking about the server start command, then no you can’t directly change the existing message, though you can add your own as shown in the FusionReactor module:

https://www.forgebox.io/view/commandbox-fusionreactor

If you’d like to make suggestions for improving the existing text, I’d love to make those changes part of the core.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks for replying.

I start the server and using server start. I’m calling it on boot up on rc.local

box start host=0.0.0.0 port=80 name=test --force

It load some messages

“WAR/Zip already installed.”

Starting in background lucee server… Server is up port stop port etc…

It would be nice to be able to customize these messages.

It’s really not a big deal if its not possible. My use case is uncommon as its for an edge server for iot. It would really be just to provide some feedback/info on boot that is a bit more obscure.

I’m curious what the difference us using an rc.local script instead of an init.d script like I’ve done here:

http://pi.bradwood.com/blog/starting-the-cfml-server-on-boot

I would say just redirect the output from the start command to dev/null and echo out whatever you want.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Just wanted to ask your thoughts on this. You asked why i used rc.local. truth had problems getting the script you wrote to work for me. I’m pretty sure it was me not you . And I got to thinking how about trying it as a system service then it could auto restart if it fails.

I set up a lucee.service in /lib/systemd/system.

#lucee.service:

[Unit]
Description=Test Server
After=network.target

[Service]
ExecStart=/usr/local/bin/box start host=0.0.0.0 port=80 name=test --force
#where I have my webroot for test
WorkingDirectory=/root/test
StandardOutput=inherit
StandardError=inherit
Restart=always
#not really needed as defaults to root
User=root

[Install]
WantedBy=multi-user.target

it starts and if I do a status on the service it started. But I cannot connect to it if I use the any ip or localhost.

root@ptg:~# systemctl status lucee.service

● lucee.service - Test Server
Loaded: loaded (/lib/systemd/system/lucee.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-01-30 09:52:24 CST; 27s ago
Main PID: 632 (java)
CGroup: /system.slice/lucee.service
└─632 java -client cliloader.LoaderCLIMain start host=0.0.0.0 port=80 name=test --force

curl http://localhost

curl: (7) Failed to connect to localhost port 80: Connection refused

box server list

pollmodbus (stopped)
http://0.0.0.0:80

CF Engine: lucee 4.5.5+006

Webroot: /root/test/

Last Started: 30-Jan-2018 10:01:47

recheck status

systemctl status lucee.service

● lucee.service - Test Server
Loaded: loaded (/lib/systemd/system/lucee.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-01-30 10:04:08 CST; 6s ago
Main PID: 3380 (java)
CGroup: /system.slice/lucee.service
└─3380 java -client cliloader.LoaderCLIMain start host=0.0.0.0 port=80 name=test --force

So systemctl says its running, but its not. Any ideas what I am doing wrong? Obviously I’m not doing something correct …

adding type= forking is the key.

Now working… :wink:

Interesting. I wonder if it has to do with the expectation that perhaps the server process that is started by the script should stay running. When you just run a server start, it starts up an intermediate process that starts the actual server and then exits. Of course, if that were the case, I’d sort of expect the opposite to be true, where the service would think the server had stopped but it was actually running. You’d need to look at the server’s logs to see if it tried to start and what happened. Also, do you see the java process running for the server?

When I use NSSM to create Windows services, I add --console to the start command so the actual server start process stays running and never exits as long as the server is up. Windows services might have a different expectation though. When I created a Linux init.d script on my Raspberry Pi, I just added && to the end of the command.

http://pi.bradwood.com/blog/starting-the-cfml-server-on-boot

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com