diff --git a/velserv-setup.sh b/velserv-setup.sh new file mode 100644 index 0000000..194ab92 --- /dev/null +++ b/velserv-setup.sh @@ -0,0 +1,15 @@ +mkdir /opt/velserv +cd /opt/velserv +wget http://www.mdar.co.uk/dl/velserv1.5.zip +apt install gcc unzip +unzip velserv1.5.zip +ln -s /opt/velserv/velserv.service /etc/systemd/system/velserv.service + +gcc -o velserv velserv.c -lpthread + +systemctl daemon-reload +systemctl enable velsev.service +systemctl start velserv.service +systemctl status velserv + +exit 0 diff --git a/velserv.service b/velserv.service new file mode 100644 index 0000000..6aecbc6 --- /dev/null +++ b/velserv.service @@ -0,0 +1,30 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +# This unit gets pulled automatically into multi-user.target by +# systemd-rc-local-generator if /etc/rc.local is executable. +[Unit] +Description=Velserv +ConditionFileIsExecutable=/opt/velserv/velserv +After=network.target +After=network-online.target + +[Service] +Type=forking +ExecStart=/opt/velserv/velserv -d /dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 -p 6000 +#ExecStart=/opt/velserv/velserv -d /dev/ttyACM0 -p 6000 +ExecStartPost=/bin/bash -c "/bin/touch /var/log/velserv.log" +ExecStartPost=/bin/bash -c "/bin/echo Velserv Started $(date) >> /var/log/velserv.log" +ExecStartPost=/bin/bash -c "/bin/pidof velserv >> /var/log/velserv.log" +ExecStop=/bin/kill $MAINPID +TimeoutSec=0 +RemainAfterExit=yes +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=multi-user.target diff --git a/velserv.sh b/velserv.sh new file mode 100644 index 0000000..fcc2525 --- /dev/null +++ b/velserv.sh @@ -0,0 +1,6 @@ +cd /opt/velserv +./velserv -d /dev/ttyACM0 -p 6000 + +# verbose output, add or remove v at end for different levels of output +# can be run without any switches. ./velserv +#sudo sh ./velserv -d /dev/ttyACM0 -p 6000 -vvvvvv diff --git a/velserv_setup.sh b/velserv_setup.sh new file mode 100644 index 0000000..9ffe839 --- /dev/null +++ b/velserv_setup.sh @@ -0,0 +1,11 @@ +sudo mkdir /opt/velserv +cd /opt/velserv +sudo wget http://www.mdar.co.uk/dl/velserv1.5.zip +sudo apt-get install gcc unzip build-essential +sudo unzip velserv1.5.zip +sudo gcc -o velserv velserv.c -lpthread +sudo ln -s /opt/velserv/velserv.service /etc/systemd/system/velserv.service +sudo systemctl daemon-reload +sudo systemctl enable velserv.service +sudo systemctl start velserv.service +systemctl status velserv \ No newline at end of file