1

I have a systemd file starting a JupyterHub:

[Unit]
Description=Jupyterhub

[Service]
User=root
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/spark/bin:/opt/hadoop/bin"
Environment="HADOOP_HOME=/opt/hadoop"
Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
ExecStart=/usr/local/bin/jupyterhub -f /opt/jupyter/jupyterhub_config.py

[Install]
WantedBy=multi-user.target

However, only the PATH variable is set, the settings for HADOOP_HOME and JAVA_HOME are ignored.

What am I missing?

rabejens
  • 173
  • 2
  • 10
  • Does this answer your question? [Systemd Environment and EnvironmentFile not working](https://serverfault.com/questions/828999/systemd-environment-and-environmentfile-not-working) – smac89 Dec 22 '20 at 07:40

1 Answers1

1

Believe it or not, it might be your use of quotes. Systemd is that rare beast that can handle multiple equal signs without getting horribly confused (in the ways you'd expect).

[Service]
Environment=HADOOP_HOME=/opt/hadoop
Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

It doesn't look like it'll work, but I have units on my system written that way and they work.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300