Philipp Schrader | 0f5d250 | 2022-03-08 22:44:55 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # This script runs after the frc971-scouting-server package is installed. This |
| 4 | # script is responsible for making sure the webserver has everything it needs, |
| 5 | # then starts the webserver. |
| 6 | |
| 7 | set -o errexit |
| 8 | set -o nounset |
| 9 | set -o pipefail |
| 10 | |
| 11 | # Create a directory for the database to live in. |
| 12 | mkdir -p /var/frc971/scouting/ |
| 13 | |
| 14 | # Create an empty The Blue Alliance configuration file. |
| 15 | if [[ ! -e /var/frc971/scouting/tba_config.json ]]; then |
| 16 | echo '{}' > /var/frc971/scouting/tba_config.json |
| 17 | fi |
| 18 | |
| 19 | # Make sure it's all usable by the user. |
| 20 | chown -R www-data:www-data /var/frc971/scouting/ |
| 21 | |
Philipp Schrader | c62aeb8 | 2022-03-18 22:02:21 -0700 | [diff] [blame] | 22 | # Update the timestamps on the files so that web browsers pull the new version. |
| 23 | # Otherwise users have to explicitly bypass the cache when visiting the site. |
| 24 | find /opt/frc971/scouting_server/scouting/www/ -type f -exec touch {} + |
| 25 | |
Philipp Schrader | 0f5d250 | 2022-03-08 22:44:55 -0800 | [diff] [blame] | 26 | systemctl daemon-reload |
| 27 | systemctl enable scouting.service |
| 28 | systemctl start scouting.service || : |