brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 3 | set -x |
| 4 | |
Austin Schuh | ab8c0c5 | 2020-02-22 13:42:37 -0800 | [diff] [blame] | 5 | if [[ "$(hostname)" == "roboRIO"* ]]; then |
Austin Schuh | ac1b775 | 2021-10-12 22:05:09 -0700 | [diff] [blame] | 6 | /usr/local/natinst/etc/init.d/systemWebServer stop |
| 7 | |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 8 | ROBOT_CODE="/home/admin/bin" |
Austin Schuh | f23a05a | 2022-02-24 18:11:23 -0800 | [diff] [blame] | 9 | cd "${ROBOT_CODE}" |
Austin Schuh | de605f1 | 2022-02-23 23:08:19 -0800 | [diff] [blame] | 10 | |
Austin Schuh | ab8c0c5 | 2020-02-22 13:42:37 -0800 | [diff] [blame] | 11 | ln -s /var/local/natinst/log/FRC_UserProgram.log /tmp/FRC_UserProgram.log |
| 12 | ln -s /var/local/natinst/log/FRC_UserProgram.log "${ROBOT_CODE}/FRC_UserProgram.log" |
Austin Schuh | 8aba48c | 2024-03-16 15:17:51 -0700 | [diff] [blame] | 13 | elif [[ "$(hostname)" == "pi-"* ]]; then |
Austin Schuh | 66e0005 | 2021-10-23 22:00:52 -0700 | [diff] [blame] | 14 | # We have systemd configured to handle restarting, so just exec. |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 15 | export PATH="${PATH}:/home/pi/bin" |
Austin Schuh | 09ec007 | 2023-02-21 14:17:02 -0800 | [diff] [blame] | 16 | exec starterd --user=pi --purge_shm_base |
Austin Schuh | 8aba48c | 2024-03-16 15:17:51 -0700 | [diff] [blame] | 17 | elif [[ "$(hostname)" == "orin-"* ]]; then |
| 18 | # We have systemd configured to handle restarting, so just exec. |
| 19 | export PATH="${PATH}:/home/pi/bin" |
| 20 | |
| 21 | # Turn the fans up. |
Tushar Pankaj | 62a78b2 | 2024-03-17 16:43:30 -0700 | [diff] [blame] | 22 | echo 255 > /sys/devices/platform/pwm-fan/hwmon/hwmon?/pwm1 |
Austin Schuh | 8aba48c | 2024-03-16 15:17:51 -0700 | [diff] [blame] | 23 | |
Tushar Pankaj | 47313c1 | 2024-03-16 17:03:53 -0700 | [diff] [blame] | 24 | # Give read permissions for INA3221 electrical readings sysfs |
| 25 | chmod -R a+r /sys/devices/platform/c240000.i2c/i2c-1/1-0040/hwmon/hwmon?/ |
| 26 | |
Austin Schuh | 8aba48c | 2024-03-16 15:17:51 -0700 | [diff] [blame] | 27 | exec starterd --user=pi --purge_shm_base |
Austin Schuh | ab8c0c5 | 2020-02-22 13:42:37 -0800 | [diff] [blame] | 28 | else |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 29 | ROBOT_CODE="${HOME}/bin" |
Austin Schuh | ab8c0c5 | 2020-02-22 13:42:37 -0800 | [diff] [blame] | 30 | fi |
| 31 | |
Austin Schuh | 540089c | 2019-12-29 20:36:16 -0800 | [diff] [blame] | 32 | cd "${ROBOT_CODE}" |
| 33 | export PATH="${PATH}:${ROBOT_CODE}" |
Brian Silverman | 17bb36d | 2015-03-29 16:50:06 -0400 | [diff] [blame] | 34 | while true; do |
Austin Schuh | 09ec007 | 2023-02-21 14:17:02 -0800 | [diff] [blame] | 35 | starterd --purge_shm_base 2>&1 |
Brian Silverman | 17bb36d | 2015-03-29 16:50:06 -0400 | [diff] [blame] | 36 | done |