Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroends authored Mar 25, 2019
1 parent 34a6882 commit f981836
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
15 changes: 15 additions & 0 deletions velserv-setup.sh
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions velserv.service
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions velserv.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions velserv_setup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f981836

Please sign in to comment.