Je pense que votre problème est dû à l'espace dans le contenu de la variable d'environnement. En regardant les exemples des documents systemd , une affectation doit être une seule chaîne:
Exemple:
Environment="ONE=one" 'TWO=two two'
ExecStart=/bin/echo $ONE $TWO ${TWO}
Cela exécutera / bin / echo avec quatre arguments: one, two, twoet two two.
Exemple:
Environment=ONE='one' "TWO='two two' too" THREE=
ExecStart=/bin/echo ${ONE} ${TWO} ${THREE}
ExecStart=/bin/echo $ONE $TWO $THREE
Cela se traduit par écho étant appelé deux fois, la première fois avec des arguments
'one', 'two two' too, et la deuxième fois avec des arguments
one, two two, too.
J'ai testé cela avec le service suivant (notez les citations autour de l'ensemble de la mission):
[Unit]
Description=My Daemon
[Service]
Environment='CATALINA_OPTS=-Dappserver.home=/var/lib/archiva/apache-tomcat-current -Dappserver.base=/var/lib/archiva/apache-tomcat-current'
ExecStart=/bin/echo ${CATALINA_OPTS}
[Install]
WantedBy=multi-user.target
Et obtenu la sortie souhaitée dans journalctl:
Apr 26 08:19:29 laptop echo[28439]: -Dappserver.home=/var/lib/archiva/apache-tomcat-current -Dappserver.base=/var/lib/archiva/apache-tomcat-current
Bien sûr, il serait plus simple à utiliser à la EnvironmentFileplace. Remplacer le Environmentpar le suivant a donné le même résultat souhaité:
EnvironmentFile=/tmp/foo
Le cas /tmp/fooéchéant (notez l'absence de guillemets):
CATALINA_OPTS=-Dappserver.home=/var/lib/archiva/apache-tomcat-current -Dappserver.base=/var/lib/archiva/apache-tomcat-current
CATALINA_OPTSdans l'systemdenvironnement pour Apachetomcat7.0.61), c'estEnvironmentFilevraiment la voie à suivre. Merci!