systemd
다음 단위 파일을 사용하는 서비스가 있습니다.
[Unit]
Description=Custom service
After=network.target
[Service]
ExecStart=/usr/local/bin/my-script
Restart=always
Environment=FOO=BAR
StandardOutput=append:/var/log/my-service/out.log
StandardError=append:/var/log/my-service/err.log
그러나 가상 머신이 다시 시작된 후에는 다시 시작되지 않습니다.
활성화하려고 하면 다음 메시지가 나타납니다.
sudo systemctl enable my-service.service
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified.
위 옵션 중 유닛 파일에 대해 어떤 옵션을 선택해야 합니까?
재부팅할 때마다 서비스를 시작하고 싶습니다.