comparison install.sh @ 32:b6f96e8738ca

Add install script to create service entry and rc.local resurrecter
author Daniel O'Connor <darius@dons.net.au>
date Mon, 13 Dec 2021 18:17:12 +1030
parents
children 7125b13d0528
comparison
equal deleted inserted replaced
31:91bfaba8f6b6 32:b6f96e8738ca
1 #!/bin/sh
2
3 root=$(cd $(dirname $0); pwd)
4
5 # Create service files for running and logging
6 mkdir -p /service/vanlogger/log
7 cat >/service/vanlogger/run <<EOF
8 #!/bin/sh
9 exec 2>&1
10 exec /usr/bin/python $root/vanlogger.py
11 EOF
12 cat <<EOF >/service/vanlogger/log/run
13 #!/bin/sh
14 exec 2>&1
15 exec multilog t s25000 n4 /var/log/vanlogger
16 EOF
17 chmod 755 /service/vanlogger/run /service/vanlogger/log/run
18
19 # Create rc.local hooks for reinstallation
20 mkdir /data/rc.local.d /data/rcS.local.d
21 cat >/data/rc.local.d/vanlogger <<EOF
22 #!/bin/sh
23 sh $root/install.sh
24 EOF
25
26 cat >/data/rc.local <<EOF
27 #!/bin/sh
28 for s in /data/rc.local.d/*; do
29 \$s
30 done
31 EOF
32
33 cat >/data/rcS.local <<EOF
34 #!/bin/sh
35 for s in /data/rcS.local.d/*; do
36 \$s
37 done
38 EOF
39
40 chmod 755 /data/rc.local.d/vanlogger /data/rc.local /data/rcS.local