Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1008 Bytes

service.md

File metadata and controls

63 lines (47 loc) · 1008 Bytes

Run metad as service

docker

$ docker run -d -p 8080:80 -p 9611:9611 --restart=always qingcloud/metad

systemd

create metad service:

cat <<EOF > /etc/systemd/system/metad.service
[Unit]
Description=metad

[Service]
ExecStart=/usr/local/bin/metad
Restart=always

[Install]
WantedBy=multi-user.target
EOF

start metad service:

$ systemctl enable metad.service
$ systemctl start  metad.service

systemd & docker

create metad service:

cat <<EOF > /etc/systemd/system/metad.service
[Unit]
Description=metad
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill metad-in-docker
ExecStartPre=-/usr/bin/docker rm metad-in-docker
ExecStartPre=/usr/bin/docker pull qingcloud/metad
ExecStart=/usr/bin/docker run --name metad-in-docker qingcloud/metad
Restart=always

[Install]
WantedBy=multi-user.target
EOF

start metad service:

$ systemctl enable metad.service
$ systemctl start  metad.service