Did You Know? You can Install Payara Server as a Service to Automatically Start on Boot
Originally published on 27 Sep 2018
Last updated on 17 Jul 2019
Did You Know...?
You can Install Payara Server as a Service to Automatically Start on Boot
In the world of pre-configured Docker & Kubernetes containers and Microservices, it’s easy to forget that not everybody is rushing to jump on the bandwagon quite yet and are still using the more traditional application server setup. With that in mind, many people like it when their servers start themselves up automatically on boot so that you don’t have to manually log onto each server and start the instances yourself. Now while you can get by using a script and a task scheduler like cron or Task Scheduler (Windows wins on the more obvious naming front here!), you can actually install Payara Server as a service like Apache HTTP Server or SSH so you can control it with your OS-native services manager.
The asadmin command to do this is:
create-service [domain-or-instance-name]
If you don’t provide a domain or instance name, it will default to using domain1.
The command takes several additional options for configuring your service, and as alluded to in the previous sentence, you’re not restricted to installing only the DAS instance as a service. You can specify an instance name with a node name in which it resides to install it as a service too.
As with any asadmin command, you can run it with the --help option to get information about the available options. Since you’re here though, I’ll briefly describe each of the options:
- --serviceuser – A Linux-only option, this allows you to specify which user should be running the service (handy if you want to create a protected user).
- --domaindir – The directory that contains the domain information (handy if you keep your domains separate from your installations).
- --nodedir & --node – The directory and node name that the instance / DAS belongs to.
- --name – A Windows-only option, this allows you to specify the name of the service. For Linux, the service name defaults to the domain or instance name.
- --serviceproperties – Additional configuration properties for the service, such as (on Windows only) setting the display name of the service.
- --dry-run – As the name suggests, runs your command without actually committing anything to help you flag up any errors or issues.
- --force – Self-explanatory, forces the creation of the service even if validation checks fail
Hope this helps!
Related Posts
The Payara Monthly Catch - October 2024
Published on 30 Oct 2024
by Chiara Civardi
0 Comments
The Payara Monthly Catch - September 2024
Published on 30 Sep 2024
by Chiara Civardi
0 Comments