Sorry if I'm still new to sysadmin world and asking such dumb question.
PS: I'm not sure whether I send this to legit-questionable email.
On 11/08/19 20.14, OFBiz wrote:
No. This is a system administration issue, not an OFBiz issue. Learn
your quotes.
David
On 8/11/19 2:57 AM, Bagas Sanjaya wrote:
Alright, so I write the following successful snippet:
[Unit]
Description=OFBiz service
Requires=nginx.service
After=nginx.service
[Service]
Type=simple
Environment="JAVA_HOME=/opt/jdk1.8.0_201"
Environment="PATH=/opt/jdk1.8.0_201/bin:/bin:/sbin:/usr/bin:/usr/sbin"
User=ofbiz
WorkingDirectory=/opt/apache-ofbiz-16.11.05
ExecStart=/opt/apache-ofbiz-16.11.05/gradlew ofbiz
ExecStop=/opt/apache-ofbiz-16.11.05/gradlew 'ofbiz --shutdown'
[Install]
WantedBy=multi-user.target
From above snippet, I noted:
- when quoting arguments for Environment= option, anything inside
quote will be interpreted literally, so "$PATH:foo" will be just
$PATH:foo. Thus I have to hard-code PATH.
- systemd requires write out full path to the executable for
ExecStart= and ExecStop= (which is gradlew wrapper in OFBiz directory
in this case), although WorkingDirectory is set to path of OFBiz.
- since I installed JDK to /opt, JAVA_HOME is set to JDK path, in
order for OFBiz to function.
On 10/08/19 18.59, Taher Alkhateeb wrote:
Hello,
I would say this is mostly a systemd question on how to setup
environment
variables, not an OFBiz specific question.
The answer is probably not simple because there are many ways. One
way for
example is to use Environment= or EnvironmentFile=. Alternatively you
can
do something like systemctl edit ofbiz-service and then edit the conf
file.
Check [1] for more info.
[1]
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Command%20lines
On Sat, Aug 10, 2019, 2:05 PM Bagas Sanjaya <[email protected]>
wrote:
Hello,
I'd like to create systemd unit for my OFBiz setup which run with
JDK from
Oracle.
However, I don't know how to set environment variables required
(JAVA_HOME
and PATH). How can I set them correctly?
I installed Oracle JDK to /opt/jdk1.8.0_201 and OFBiz to
/opt/apache-ofbiz-16.11.05.
Kind regards, Bagas
--
An old man doll... just what I always wanted! - Clara
--
An old man doll... just what I always wanted! - Clara