diff --git a/scripts/systemd/cmvr-es.service b/scripts/systemd/cmvr-es.service new file mode 100644 index 00000000..fa39b50a --- /dev/null +++ b/scripts/systemd/cmvr-es.service @@ -0,0 +1,31 @@ +[Unit] +Description=CMVR ES (CAN -> EtherCAT enp2s0 -> runtime) +Wants=network-online.target +Requires=sys-subsystem-net-devices-can0.device sys-subsystem-net-devices-can1.device sys-subsystem-net-devices-can2.device sys-subsystem-net-devices-can3.device +After=network-online.target sys-subsystem-net-devices-can0.device sys-subsystem-net-devices-can1.device sys-subsystem-net-devices-can2.device sys-subsystem-net-devices-can3.device itekon-can@can0.service itekon-can@can1.service itekon-can@can2.service itekon-can@can3.service +StartLimitIntervalSec=300 +StartLimitBurst=3 + +[Service] +Type=simple +User=cmvr +Group=cmvr +SupplementaryGroups=plugdev +WorkingDirectory=/home/cmvr/project/cmvr-es/output/bin +Environment=LD_LIBRARY_PATH=/home/cmvr/project/cmvr-es/output/lib +ExecStartPre=+/bin/bash -e /home/cmvr/project/cmvr-es/scripts/start_can.sh +ExecStartPre=+/bin/bash /home/cmvr/project/cmvr-es/scripts/ethercat/start_ethercat.sh enp2s0 +ExecStart=/home/cmvr/project/cmvr-es/output/bin/cmvr_es +ExecStopPost=+/bin/bash /home/cmvr/project/cmvr-es/scripts/ethercat/stop_ethercat.sh enp2s0 +Restart=on-failure +RestartSec=10 +TimeoutStartSec=120 +TimeoutStopSec=30 +KillSignal=SIGTERM +LimitRTPRIO=99 +LimitMEMLOCK=infinity +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target