Cara Buat Service Startup untuk Motion via systemd
1. Buat File Service
Buka terminal dan buat file service baru dengan perintah:
sudo nano /etc/systemd/system/motion-custom.service
2. Isi File dengan Konfigurasi Berikut
[Unit]
Description=Motion Service (Custom)
After=network.target
[Service]
ExecStart=/usr/bin/motion -c /etc/motion/motion.conf
User=root
Group=video
Restart=on-failure
[Install]
WantedBy=multi-user.target
🔍 Tips: Pastikan path ke motion
benar. Cek dengan perintah:
which motion → biasanya hasilnya /usr/bin/motion
3. Reload systemd dan Enable Service
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable motion-custom.service
4. Mulai Service atau Reboot
sudo systemctl start motion-custom.service
# atau reboot
sudo reboot
5. Cek Status Service
sudo systemctl status motion-custom.service