pre and post boot command scripts

334 views
Skip to first unread message

Hans Pikkemaat

unread,
May 5, 2021, 10:04:36 AM5/5/21
to Payara Forum
Hi,

I'm using payara-server-full and am able to use pre and post boot command scripts using the following options when starting the domain

asadmin start-domain --prebootcommandfile=pre-boot-commands.asadmin and --postbootcommandfile=post-boot-commands.asadmin

But I'm wondering if this is fully supported because I can only find documentation about it in the payara-micro section.

best regards, Hans

Hans Pikkemaat

unread,
May 5, 2021, 11:00:42 AM5/5/21
to Payara Forum
Also I noticed that there is no logging output from the pre and post boot files, also not when there are errors.
Can this be activated somewhere?

Ondro Mihályi

unread,
May 6, 2021, 5:15:27 AM5/6/21
to Hans Pikkemaat, Payara Forum
Hello,

Using post boot command file with Payara Server is documented here: https://docs.payara.fish/community/docs/documentation/payara-server/asadmin-commands/server-management-commands.html#start-domain. Payara Server logs output of the commands in the server log file with the fish.payara.boot.runtime.BootCommand logger. For example, if I attempt to run an invalid command "set x=y", this is the error output:

[2021-05-06T11:13:25.741+0200] [Payara 5.27.0] [INFO] [] [] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1620292405741] [levelValue: 800] [[
  Reading in commandments from /home/omihalyi/postboot.asadmin]]

[2021-05-06T11:13:25.788+0200] [Payara 5.27.0] [WARNING] [] [fish.payara.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1620292405788] [levelValue: 900] [[
  Boot Command set failed PlainTextActionReporterFAILUREInvalid attribute name x ]]

st 5. 5. 2021 o 17:00 Hans Pikkemaat <the...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/CA%2Bk6B5o6PanufnQaiA6Q82cqCa9bzqkTxmBQg91cSG6Jpqg6Sw%40mail.gmail.com.

Hans Pikkemaat

unread,
May 6, 2021, 9:40:52 AM5/6/21
to Payara Forum
Thanks Ondro,

Is it also possible to log the successful commands?

best regards, Hans

Hans Pikkemaat

unread,
May 6, 2021, 9:46:12 AM5/6/21
to Payara Forum
Hi Ondro,

Never mind, I see the SUCCESS logs in the server.log.

One last thing.
I'm using docker and the java.util.logging.ConsoleHandler log handler but I don't see the logs in the docker logs.
This was actually the trigger of this question. I did not check the server logs because I assumed they also would be in the docker logs.

So how can I get those to show up there as well?

best regards, Hans


Hans Pikkemaat

unread,
May 6, 2021, 9:50:11 AM5/6/21
to Payara Forum
Hi Ondro,

Sorry for wasting your time. The problem was that I do two times start-domain, once without -v and once with -v. The first time clearly does not produce the logs to stdout.
This was my problem.

tx again, Hans

Hans Pikkemaat

unread,
May 6, 2021, 9:52:08 AM5/6/21
to Payara Forum
BTW, if a boot command fails, is it possible to cancel the start-domain? So when using -v, that it simply stops?

Hans Pikkemaat

unread,
May 6, 2021, 10:12:32 AM5/6/21
to Payara Forum
So my underlying problem is that I do a start-domain, then all kinds of commands, stop-domain, start-domain because some of the commands need a restart.
In principle it may be possible to put a number of commands in pre-boot and the rest in post-boot after which I don't need this restart of the domain?

The big question is then: which commands can go in pre-boot? Is that documented? Or can I assume that all commands that change the domain.xml can go in pre-boot?

best regards, Hans

Ondro Mihályi

unread,
May 6, 2021, 12:40:56 PM5/6/21
to Hans Pikkemaat, Payara Forum
Hi,

It's not documented which commands can go to preboot and which to postboot, but from my experience, only the set command works in preboot. The set command directly modifies domain.xml and doesn't need any service to run, while other commands usually need some service that is available only when the postboot commands are executed. If you need to run some commands that require server restart, then it's better to launch Payara Server in background, apply those commands using another asadmin process, and then stop the domain. You can run multiple commands using the asadmin multimode command, which accepts a file with a sequence of asadmin commands: https://docs.oracle.com/cd/E26576_01/doc.312/e24938/multimode.htm#GSRFM00213

Ondro

št 6. 5. 2021 o 16:12 Hans Pikkemaat <the...@gmail.com> napísal(a):
Reply all
Reply to author
Forward
0 new messages