Доброго времени суток.
Уже сломал голову и много раз был в гугле, прошу туда не посылать.)
Не могу победить автостарт сервиса nut-server (Network Ups Tools)
в Centos 7 (x86_64).
Исходные данные.
- OS - Centos 7 (x86_64). Ядро последнее 3.10.0-693.17.1.el7.x86_64 #1 SMP
- Все пакеты обновлены.
- ФС - xfs
- Установлены пакеты: nut-2.7.2-3.el7.x86_64 nut-client-2.7.2-3.el7.x86_64
Конфиги:
/etc/ups/nut.conf
MODE=netserver
[SmartUPS3]
driver = apcsmart
port = /dev/ttya001
cable = 940-024C
desc = "APS Smart-UPS 2200"
[admin]
password = 123456
actions = SET
instcmds = ALL
[upsmon_local]
password = 123456
upsmon master
[upsmon_remote]
password = 123456
upsmon slave
/etc/ups/upsmon.conf
RUN_AS_USER nut
MONITOR SmartUPS3@localhost 0 upsmon_local 123456 master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/bin/upsnotify
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYMSG ONLINE "UPS %s online power"
NOTIFYMSG ONBATT "UPS %s onbattery"
NOTIFYMSG LOWBATT "UPS %s battery is low"
NOTIFYMSG FSD "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK "Communications with UPS %s established"
NOTIFYMSG COMMBAD "Communications with UPS %s lost"
NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding"
NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
NOTIFYMSG NOCOMM "UPS %s is unavailable"
NOTIFYMSG NOPARENT "Upsmon parent process died - shutdown impossible"
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
NOTIFYFLAG COMMOK SYSLOG+EXEC
NOTIFYFLAG COMMBAD SYSLOG+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+EXEC
NOTIFYFLAG REPLBATT SYSLOG+EXEC
NOTIFYFLAG NOCOMM SYSLOG+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
systemctl enable nut-server
systemctl start nut-server
# service nut-server status
Redirecting to /bin/systemctl status nut-server.service
● nut-server.service - Network UPS Tools - power devices information server
Loaded: loaded (/usr/lib/systemd/system/nut-server.service; enabled; vendor preset: disabled)
Active: inactive (dead)
янв 26 19:33:19 aa27.niisi.ru systemd[1]: Dependency failed for Network UPS Tools - power devices information server.
янв 26 19:33:19 aa27.niisi.ru systemd[1]: Job nut-server.service/start failed with result 'dependency'.
Jan 25 23:09:56 aa27 upsdrvctl: Can't chdir to /var/run/nut: No such file or directory
Jan 25 23:09:56 aa27 systemd: nut-driver.service: control process exited, code=exited status=1
Jan 25 23:09:56 aa27 systemd: Job nut-server.service/start failed with result 'dependency'.
Jan 25 23:09:56 aa27 systemd: Unit nut-driver.service entered failed state.
Jan 25 23:09:56 aa27 systemd: nut-driver.service failed.
Jan 25 23:14:05 aa27 systemd-tmpfiles: Failed to open '/etc/tmpfiles.d/nut-run.conf', ignoring: No such file or directory
service nut-server start
(это сосбтвенно и рекомендовали в интернетах).
Посмотрел внимательно юниты старта сервера, их три:
nut-server.service
[Unit]
Description=Network UPS Tools - power devices information server
After=local-fs.target network.target nut-driver.service
Requires=nut-driver.service
Before=nut-monitor.service
[Service]
ExecStart=/usr/sbin/upsd -F
Type=simple
[Install]
WantedBy=multi-user.target
[Unit]
Description=Network UPS Tools - power device driver controller
After=local-fs.target network.target
StopWhenUnneeded=yes
[Service]
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /etc/tmpfiles.d/nut-run.conf
ExecStart=/usr/sbin/upsdrvctl start
ExecStop=/usr/sbin/upsdrvctl stop
Type=forking
[Unit]
Description=Network UPS Tools - power device monitor and shutdown controller
After=local-fs.target network.target nut-server.service
[Service]
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /etc/tmpfiles.d/nut-run.conf
ExecStart=/usr/sbin/upsmon -F
Type=simple
[Install]
WantedBy=multi-user.target
Что выяснилось - если отключить автостарт и запускать последовательно драйвер ...(упс и сразу облом)
Jan 25 23:09:56 aa27 upsdrvctl: Can't chdir to /var/run/nut: No such file or directory
Пробовал менять порядок загрузки сервисов, но не взлетело. Не силен в systemd.
Прошу дать правильное направление. И вот еще, касательно вот этой ошибки:
/usr/bin/systemd-tmpfiles --create /etc/tmpfiles.d/nut-run.conf
Failed to open '/etc/tmpfiles.d/nut-run.conf', ignoring: No such file or directory
# systemctl status systemd-tmpfiles-setup
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static; vendor preset: disabled)
Active: active (exited) since Пт 2018-01-26 19:33:18 MSK; 2h 2min left
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Process: 481 ExecStart=/usr/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS)
Main PID: 481 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/systemd-tmpfiles-setup.service
янв 26 19:33:18 aa27.niisi.ru systemd[1]: Starting Create Volatile Files and Directories...
янв 26 19:33:18 aa27.niisi.ru systemd[1]: Started Create Volatile Files and Directories.