mirror of https://bitbucket.org/ausocean/av.git
Merged in systemd-unit (pull request #413)
init: make systemd service unit for rv Approved-by: Saxon Milton
This commit is contained in:
commit
90c39db59d
|
@ -41,11 +41,13 @@ make_dirs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
soft_copy_files:
|
soft_copy_files:
|
||||||
if [ -f /etc/rc.local ] ; then \
|
if [ -f /etc/systemd/system/rv.service ] ; then \
|
||||||
echo "/etc/rc.local left unmodified" ; \
|
echo "/etc/systemd/system/rv.service left unmodified" ; \
|
||||||
else \
|
else \
|
||||||
cp rc.local /etc; \
|
cp rv.service /etc/systemd/system; \
|
||||||
fi
|
fi
|
||||||
|
systemctl enable rv.service
|
||||||
|
chmod +x pi_run.sh
|
||||||
if [ -f /etc/netsender.conf ] ; then \
|
if [ -f /etc/netsender.conf ] ; then \
|
||||||
echo "/etc/netsender.conf left unmodified" ; \
|
echo "/etc/netsender.conf left unmodified" ; \
|
||||||
else \
|
else \
|
||||||
|
@ -54,11 +56,12 @@ soft_copy_files:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hard_copy_files:
|
hard_copy_files:
|
||||||
if [ -f /etc/rc.local ] ; then \
|
if [ -f /etc/systemd/system/rv.service ] ; then \
|
||||||
echo "Backed up rc.local to /etc/rc.local.bak" ; \
|
echo "/etc/systemd/system/rv.service overwritten" ; \
|
||||||
cp /etc/rc.local /etc/rc.local.bak ; \
|
|
||||||
fi
|
fi
|
||||||
cp -f rc.local /etc
|
cp -f rv.service /etc/systemd/system
|
||||||
|
systemctl enable rv.service
|
||||||
|
chmod +x pi_run.sh
|
||||||
if [ -f /etc/netsender.conf ] ; then \
|
if [ -f /etc/netsender.conf ] ; then \
|
||||||
echo "Backed up netsender.conf to /etc/netsender.conf.bak"; \
|
echo "Backed up netsender.conf to /etc/netsender.conf.bak"; \
|
||||||
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
|
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
|
||||||
|
@ -76,6 +79,6 @@ syncreboot:
|
||||||
clean: as_root
|
clean: as_root
|
||||||
rm -rf /var/netsender
|
rm -rf /var/netsender
|
||||||
rm -rf /var/log/netsender
|
rm -rf /var/log/netsender
|
||||||
rm -rf /etc/rc.local
|
rm -rf /etc/systemd/system/rv.service
|
||||||
rm -rf /etc/netsender.conf
|
rm -rf /etc/netsender.conf
|
||||||
@echo "Clean complete"
|
@echo "Clean complete"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# /etc/rc.local
|
# This script launches rv on a pi, intended to run at boot time.
|
||||||
# This script launches rv at boot time
|
|
||||||
|
|
||||||
RVPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/rv
|
RVPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/rv
|
||||||
|
|
||||||
|
@ -35,5 +34,12 @@ GOPATH=$HOME/go
|
||||||
RVPATH=$GOPATH/src/bitbucket.org/ausocean/av/cmd/rv
|
RVPATH=$GOPATH/src/bitbucket.org/ausocean/av/cmd/rv
|
||||||
PATH=$PATH:/usr/local/go/bin:$RVPATH
|
PATH=$PATH:/usr/local/go/bin:$RVPATH
|
||||||
cd $RVPATH
|
cd $RVPATH
|
||||||
sudo -u pi HOME=$HOME GOPATH=$GOPATH PATH=$PATH ./rv &
|
sudo -u pi HOME=$HOME GOPATH=$GOPATH PATH=$PATH ./rv
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "Successfully exited rv"
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
echo "rv exited with code: $?" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Netsender Client for Media Collection and Forwarding
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/home/pi/go/src/bitbucket.org/ausocean/av/init/pi_run.sh
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue