Я пытаюсь создать службу с помощью systemctl на моем сервере CentOS 7.
В / usr / lib / systemd / system У меня такая ситуация ...
[root@centos-4gb-hel1-1 system]# pwd
/usr/lib/systemd/system
[root@centos-4gb-hel1-1 system]# ls -la getUpdatesTelegram.sh
-rwxr-xr-x. 1 root root 116 Oct 24 22:32 getUpdatesTelegram.sh
[root@centos-4gb-hel1-1 system]# cat getUpdatesTelegram.sh
#!/bin/bash
while true ; do
/var/www/html/OpenProntoSoccorsi/TelegramBot/getUpdates_launcher.sh
sleep 5
done
[root@centos-4gb-hel1-1 system]#
Если я пытаюсь выполнить
/var/www/html/OpenProntoSoccorsi/TelegramBot/getUpdates_launcher.sh
, все работает нормально.
В / etc / systemd / system я имею это ....
[root@centos-4gb-hel1-1 system]# cd /etc/systemd/system
[root@centos-4gb-hel1-1 system]# ls -la
total 40
drwxr-xr-x. 10 root root 4096 Oct 24 22:05 .
drwxr-xr-x. 4 root root 4096 Oct 18 22:41 ..
drwxr-xr-x. 2 root root 4096 Sep 24 12:31 basic.target.wants
lrwxrwxrwx. 1 root root 37 Sep 24 12:29 default.target -> /lib/systemd/system/multi-user.target
drwxr-xr-x. 2 root root 4096 Sep 24 12:26 default.target.wants
drwxr-xr-x. 2 root root 4096 Sep 24 12:27 dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
drwxr-xr-x. 2 root root 4096 Sep 24 12:26 getty.target.wants
drwxr-xr-x. 2 root root 4096 Sep 24 12:31 local-fs.target.wants
drwxr-xr-x. 2 root root 4096 Oct 24 22:32 multi-user.target.wants
drwxr-xr-x. 2 root root 4096 Sep 24 12:31 sysinit.target.wants
drwxr-xr-x. 2 root root 4096 Sep 24 12:26 system-update.target.wants
[root@centos-4gb-hel1-1 system]# cd multi-user.target.wants/
[root@centos-4gb-hel1-1 multi-user.target.wants]# ls -la
total 8
drwxr-xr-x. 2 root root 4096 Oct 24 22:32 .
drwxr-xr-x. 10 root root 4096 Oct 24 22:05 ..
lrwxrwxrwx. 1 root root 38 Sep 24 12:27 auditd.service -> /usr/lib/systemd/system/auditd.service
lrwxrwxrwx. 1 root root 37 Sep 24 12:31 brandbot.path -> /usr/lib/systemd/system/brandbot.path
lrwxrwxrwx. 1 root root 39 Sep 24 12:27 chronyd.service -> /usr/lib/systemd/system/chronyd.service
lrwxrwxrwx. 1 root root 44 Sep 24 12:33 cloud-config.service -> /usr/lib/systemd/system/cloud-config.service
lrwxrwxrwx. 1 root root 43 Sep 24 12:33 cloud-final.service -> /usr/lib/systemd/system/cloud-final.service
lrwxrwxrwx. 1 root root 48 Sep 24 12:33 cloud-init-local.service -> /usr/lib/systemd/system/cloud-init-local.service
lrwxrwxrwx. 1 root root 42 Sep 24 12:33 cloud-init.service -> /usr/lib/systemd/system/cloud-init.service
lrwxrwxrwx. 1 root root 37 Sep 24 12:26 crond.service -> /usr/lib/systemd/system/crond.service
lrwxrwxrwx. 1 root root 50 Oct 24 22:32 getUpdatesTelegram.service -> /usr/lib/systemd/system/getUpdatesTelegram.service
lrwxrwxrwx. 1 root root 42 Sep 24 12:27 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 37 Sep 24 12:29 kdump.service -> /usr/lib/systemd/system/kdump.service
lrwxrwxrwx. 1 root root 40 Sep 24 12:26 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 46 Sep 24 12:31 rhel-configure.service -> /usr/lib/systemd/system/rhel-configure.service
lrwxrwxrwx. 1 root root 39 Sep 24 12:26 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root 36 Sep 24 12:27 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 37 Sep 24 12:26 tuned.service -> /usr/lib/systemd/system/tuned.service
[root@centos-4gb-hel1-1 multi-user.target.wants]# cat getUpdatesTelegram.service
[Service]
Type=simple
ExecStart=/bin/bash /bin/getUpdatesTelegram.sh
[Install]
WantedBy=multi-user.target
[root@centos-4gb-hel1-1 multi-user.target.wants]#
КогдаЯ пытаюсь выполнить
systemctl enable getUpdatesTelegram.service
Я получаю
...
...
getUpdatesTelegram.service loaded failed failed getUpdatesTelegram.service
...
...
Журнал, который у меня есть, следующий ...
[root@centos-4gb-hel1-1 multi-user.target.wants]# journalctl -u getUpdatesTelegram.service
-- Logs begin at Fri 2018-10-19 20:09:02 CEST, end at Wed 2018-10-24 22:44:11 CEST. --
Oct 24 21:44:10 centos-4gb-hel1-1 systemd[1]: Started getUpdatesTelegram.service.
Oct 24 21:44:10 centos-4gb-hel1-1 systemd[1]: Starting getUpdatesTelegram.service...
Oct 24 21:44:10 centos-4gb-hel1-1 systemd[1]: getUpdatesTelegram.service: main process exited, code=exited, status=203/EXEC
Oct 24 21:44:10 centos-4gb-hel1-1 systemd[1]: Unit getUpdatesTelegram.service entered failed state.
Oct 24 21:44:10 centos-4gb-hel1-1 systemd[1]: getUpdatesTelegram.service failed.
Где я ошибаюсь?
Заранее спасибо!