init: make a systemd unit service to launch rv

updated makefile
renamed script from rc.local to pi_run.sh since we wont use rc.local anymore
This commit is contained in:
Trek H 2020-05-13 01:34:57 +09:30
parent 5699dc2f97
commit 3c2fefa8cb
3 changed files with 22 additions and 10 deletions

View File

@ -41,11 +41,13 @@ make_dirs:
fi
soft_copy_files:
if [ -f /etc/rc.local ] ; then \
echo "/etc/rc.local left unmodified" ; \
if [ -f /etc/systemd/system/rv.service ] ; then \
echo "/etc/systemd/system/rv.service left unmodified" ; \
else \
cp rc.local /etc; \
cp rv.service /etc/systemd/system; \
fi
systemctl enable rv.service
chmod +x pi_run.sh
if [ -f /etc/netsender.conf ] ; then \
echo "/etc/netsender.conf left unmodified" ; \
else \
@ -54,11 +56,12 @@ soft_copy_files:
fi
hard_copy_files:
if [ -f /etc/rc.local ] ; then \
echo "Backed up rc.local to /etc/rc.local.bak" ; \
cp /etc/rc.local /etc/rc.local.bak ; \
if [ -f /etc/systemd/system/rv.service ] ; then \
echo "/etc/systemd/system/rv.service overwritten" ; \
fi
cp -f rc.local /etc
cp -f cp rv.service /etc/systemd/system
systemctl enable rv.service
chmod +x pi_run.sh
if [ -f /etc/netsender.conf ] ; then \
echo "Backed up netsender.conf to /etc/netsender.conf.bak"; \
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
@ -76,6 +79,6 @@ syncreboot:
clean: as_root
rm -rf /var/netsender
rm -rf /var/log/netsender
rm -rf /etc/rc.local
rm -rf /etc/systemd/system/rv.service
rm -rf /etc/netsender.conf
@echo "Clean complete"

View File

@ -1,6 +1,5 @@
#!/bin/sh -e
# /etc/rc.local
# This script launches rv at boot time
# This script launches rv on a pi, intended to run at boot time.
RVPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/rv

10
init/rv.service Normal file
View File

@ -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