diff --git a/BenzObstacleDetect/BenzObstacleDetect.csproj b/BenzObstacleDetect/BenzObstacleDetect.csproj index 264556f..1745c4a 100644 --- a/BenzObstacleDetect/BenzObstacleDetect.csproj +++ b/BenzObstacleDetect/BenzObstacleDetect.csproj @@ -13,7 +13,9 @@ - + + contentFiles + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/autolabor.benz.obstacle.service b/autolabor.benz.obstacle.service new file mode 100644 index 0000000..651a3a6 --- /dev/null +++ b/autolabor.benz.obstacle.service @@ -0,0 +1,12 @@ +[Unit] +Description=Start Autolabor.Benz.Obstacle Service +After=multi-user.target + +[Service] +User=autolabor +WorkingDirectory=/home/autolabor +ExecStart=/home/autolabor/app/Autolabor.Benz.ObstacleDetection/detection.sh +Restart=on-failure + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/detection.sh b/detection.sh new file mode 100644 index 0000000..dcaeae0 --- /dev/null +++ b/detection.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# 获取当前脚本所在目录的绝对路径 +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +echo "脚本当前目录:$SCRIPT_DIR" + +mono "$SCRIPT_DIR"/bin/publish/BenzObstacleDetect.exe \ No newline at end of file