Score:0

How to add defined environment variable to a .service file

eg flag

I'm installing Tomcat and one of the last steps requires to define a .service file for it. In that file I must define a line with

Environment="JAVA_HOME=path_to_java"

I already have a JAVA_HOME environment variable defined, is there any way of point to it from the .service file? Something like:

Environment="JAVA_HOME=$JAVA_HOME"
Score:1
cn flag

A systemd service file is not interpreted by the shell (be it shor bash), so you need to be explicit in such system files and specify the literal value. Especially for system wide services, any of your environmental variables may not even be defined yet when it is run.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.