view 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
line wrap: on
line source

#!/bin/sh

root=$(cd $(dirname $0); pwd)

# Create service files for running and logging
mkdir -p /service/vanlogger/log >/dev/null 2>&1
cat >/service/vanlogger/run <<EOF
#!/bin/sh
exec 2>&1
exec /usr/bin/python $root/vanlogger.py
EOF
cat <<EOF >/service/vanlogger/log/run
#!/bin/sh
exec 2>&1
exec multilog t s25000 n4 /var/log/vanlogger
EOF
chmod 755 /service/vanlogger/run /service/vanlogger/log/run

# Create rc.local hooks for reinstallation
mkdir /data/rc.local.d /data/rcS.local.d >/dev/null 2>&1
cat >/data/rc.local.d/vanlogger <<EOF
#!/bin/sh
sh $root/install.sh
EOF

cat >/data/rc.local <<EOF
#!/bin/sh
for s in /data/rc.local.d/*; do
  \$s
done
EOF

cat >/data/rcS.local <<EOF
#!/bin/sh
for s in /data/rcS.local.d/*; do
  \$s
done
EOF

chmod 755 /data/rc.local.d/vanlogger /data/rc.local /data/rcS.local