Ads 468x60px

##EasyReadMore##

02 3月, 2017

從別的機台複製整個 deamon 以 mosquitto 為例

尋找有關的 mosquitto 檔案

cat /lib/systemd/system/mosquitto.service
知道 /usr/sbin/mosquitto -c /etc/mosquitto/conf.d 要cp 過去

find /usr/ -name mosquitto*
結果得知 下面的 要 cp 過去
    /usr/bin/mosquitto_passwd
    /usr/bin/mosquitto_sub
    /usr/bin/mosquitto_pub
    /usr/sbin/mosquitto

複製檔案到目的

scp -r /etc/mosquitto/ root@192.168.11.22:/etc/mosquitto/
scp /usr/sbin/mosquitto  root@192.168.11.22:/usr/sbin
scp /usr/bin/mosquitto*  root@192.168.11.22:/usr/bin
scp /lib/systemd/system/mosquitto.service  root@192.168.11.22:/lib/systemd/system/

啟動程序

systemctl enable mosquitto
出現下面錯誤
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

因為找不到 install target
vim /lib/systemd/system/mosquitto.service

[Install]
WantedBy=multi-user.target

systemctl start mosquitto

ps 後有看到 mosquitto 即成功

0 意見:

張貼留言

 
Blogger Templates