6

I have a service with this for a sidekick unit and keep receiving the error: [/run/fleet/units/[email protected]:11] Trailing garbage, ignoring. [email protected] has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.

I have seemingly tried every different combination I can think of and have successfully tested the command from the terminal without issue. If I remove the first call to etcdctl the second set command also works in the service file without issue. Any ideas as to where I am going wrong here?

[Unit] Description=Tomcat web server etcd registration # Requirements Requires=etcd.service Requires=tomcat@%i.service # Dependency ordering and binding After=etcd.service After=tomcat@%i.service BindsTo=tomcat@%i.service [Service] # Get CoreOS environmental variables EnvironmentFile=/etc/environment # Start ExecStart=/bin/bash -c "\ while true; do \ etcdctl set /services/tomcat/tomcat-%i/ip ${COREOS_PRIVATE_IPV4}:$(docker inspect --format='{{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}}' tomcat.%i) --ttl 180; \ etcdctl set /services/bind/tomcat-%i ${COREOS_PRIVATE_IPV4} --ttl 180; \ sleep 60; \ done" # Stop ExecStop=/usr/bin/etcdctl rm --recursive /services/tomcat/tomcat-%i [X-Fleet] # Schedule on the same machine as the associated Apache service MachineOf=tomcat@%i.service 

1 Answer 1

3

I was able to correct the error by using single quotes around the /bin/bash -c command, using double quotes around the --format and double escape the port number. The final full ExecStart command is:

ExecStart=/bin/bash -c '\ while true; do \ etcdctl set /services/tomcat/tomcat-%i/ip ${COREOS_PRIVATE_IPV4}:$(docker inspect --format="{{(index (index .NetworkSettings.Ports \\"8080/tcp\\") 0).HostPort}}" tomcat.%i) --ttl 180; \ etcdctl set /services/bind/tomcat-%i ${COREOS_PRIVATE_IPV4} --ttl 180; \ sleep 60; \ done' 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.