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