Hello, I have a droplet with CoreOS and system reboots once a two/three days accidentally. After every reboot I need to restart my docker containers. To get it I create systemd unit ***.service with the next structure:
[Unit]
Description=*** service
After=docker.service
[Service]
ExecStart="/usr/bin/docker run -d -p 80:80 *** /usr/sbin/apache2ctl -D FOREGROUND"
[Install]
WantedBy=multi-user.target
When I try to start it as:
sudo systemctl start ***.service
It crashes with error:
Oct 08 07:18:47 *** systemd[1]: [/etc/systemd/system/***.service:6] Executable path is not absolute, ignoring: "/usr/bin/docker run -d -p 80:80 *** /...-D FOREGROUND"
Oct 08 07:18:47 *** systemd[1]: ***.service lacks ExecStart setting. Refusing.
How can I restrict CoreOS accidental reboots? And how can I fix my error with systemctl?
Thanks in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The problem seems to be due to the ExecStart arguments being quoted. To confirm this I just tried this unit file:
[Unit]
Description=apache service
After=docker.service
[Service]
ExecStart=/usr/bin/docker run -d -p 80:80 coreos/apache /usr/sbin/apache2ctl -D FOREGROUND
[Install]
WantedBy=multi-user.target
Without quotes, it runs as expected. With them, it fails with:
systemd[1]: [/etc/systemd/system/apache.service:5] Executable path is not absolute, ignoring: "/usr/bi...GROUND"
systemd[1]: apache.service lacks ExecStart setting. Refusing.
systemd[1]: [/etc/systemd/system/apache.service:5] Executable path is not absolute, ignoring: "/usr/bi...GROUND"
systemd[1]: apache.service lacks ExecStart setting. Refusing.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.