|
12 | 12 | # Dependent script: /etc/rc.local (which runs with 'set -e') |
13 | 13 | # File path: /etc/custom_service/start_service.sh |
14 | 14 | # |
15 | | -# Version: v1.1 |
| 15 | +# Version: v1.2 |
16 | 16 | # |
17 | 17 | #======================================================================================== |
18 | 18 |
|
@@ -42,64 +42,66 @@ log_message "Detected FDT file: ${FDT_FILE:-'not found'}" |
42 | 42 |
|
43 | 43 | # For Tencent Aurora 3Pro (s905x3-b) box: Load Bluetooth module |
44 | 44 | if [[ "${FDT_FILE}" == "meson-sm1-skyworth-lb2004-a4091.dtb" ]]; then |
45 | | - modprobe btmtksdio 2>/dev/null || true |
| 45 | + modprobe btmtksdio >/dev/null 2>&1 & |
46 | 46 | log_message "Attempted to load btmtksdio module for Tencent-Aurora-3Pro." |
47 | 47 | fi |
48 | 48 |
|
49 | 49 | # For swan1-w28(rk3568) board: USB power and switch control |
50 | 50 | if [[ "${FDT_FILE}" == "rk3568-swan1-w28.dtb" ]]; then |
51 | 51 | # GPIO operations are critical, but we also add error suppression. |
52 | | - gpioset 0 21=1 2>/dev/null |
53 | | - gpioset 3 20=1 2>/dev/null |
54 | | - gpioset 4 21=1 2>/dev/null |
55 | | - gpioset 4 22=1 2>/dev/null |
| 52 | + gpioset 0 21=1 >/dev/null 2>&1 |
| 53 | + gpioset 3 20=1 >/dev/null 2>&1 |
| 54 | + gpioset 4 21=1 >/dev/null 2>&1 |
| 55 | + gpioset 4 22=1 >/dev/null 2>&1 |
56 | 56 | log_message "USB power control GPIOs set for Swan1-w28." |
57 | 57 | fi |
58 | 58 |
|
59 | 59 | # For smart-am60(rk3588)/orangepi-5b(rk3588s) board: Bluetooth control |
60 | 60 | if [[ "${FDT_FILE}" =~ ^(rk3588-smart-am60\.dtb|rk3588s-orangepi-5b\.dtb)$ ]]; then |
61 | 61 | # This is a sequence of commands, with the last one running in the background. |
62 | 62 | # The background command (&) won't affect the script's exit code. |
63 | | - rfkill block all |
64 | | - chmod a+x /lib/firmware/ap6276p/brcm_patchram_plus1 2>/dev/null || true |
65 | | - sleep 2 |
66 | | - rfkill unblock all |
67 | | - /lib/firmware/ap6276p/brcm_patchram_plus1 --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /lib/firmware/ap6275p/BCM4362A2.hcd /dev/ttyS9 & |
| 63 | + ( |
| 64 | + rfkill block all |
| 65 | + chmod a+x /lib/firmware/ap6276p/brcm_patchram_plus1 >/dev/null 2>&1 & |
| 66 | + sleep 2 |
| 67 | + rfkill unblock all |
| 68 | + /lib/firmware/ap6276p/brcm_patchram_plus1 --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /lib/firmware/ap6275p/BCM4362A2.hcd /dev/ttyS9 & |
| 69 | + ) & |
68 | 70 | log_message "Bluetooth firmware download process started for Smart-am60/orangepi-5b." |
69 | 71 | fi |
70 | 72 |
|
71 | 73 | # General System Services |
72 | 74 |
|
73 | 75 | # Restart ssh service |
74 | | -mkdir -p -m0755 /var/run/sshd 2>/dev/null |
| 76 | +mkdir -p -m0755 /var/run/sshd >/dev/null 2>&1 |
75 | 77 | if [[ -f "/etc/init.d/ssh" ]]; then |
76 | | - (sleep 5 && /etc/init.d/ssh restart 2>/dev/null) || true |
| 78 | + (sleep 5 && /etc/init.d/ssh restart >/dev/null 2>&1) & |
77 | 79 | log_message "SSH service restart attempted." |
78 | 80 | fi |
79 | 81 |
|
80 | 82 | # Add network performance optimization |
81 | 83 | if [[ -x "/usr/sbin/balethirq.pl" ]]; then |
82 | | - (perl /usr/sbin/balethirq.pl 2>/dev/null) || true |
| 84 | + (perl /usr/sbin/balethirq.pl >/dev/null 2>&1) & |
83 | 85 | log_message "Network optimization service (balethirq.pl) execution attempted." |
84 | 86 | fi |
85 | 87 |
|
86 | 88 | # Led display control |
87 | 89 | openvfd_enable="no" |
88 | 90 | openvfd_boxid="15" |
89 | 91 | if [[ "${openvfd_enable}" == "yes" && -n "${openvfd_boxid}" && -x "/usr/sbin/armbian-openvfd" ]]; then |
90 | | - (armbian-openvfd "${openvfd_boxid}") || true |
| 92 | + (armbian-openvfd "${openvfd_boxid}") & |
91 | 93 | log_message "OpenVFD service execution attempted." |
92 | 94 | fi |
93 | 95 |
|
94 | 96 | # For vplus(Allwinner h6) led color lights |
95 | 97 | if [[ -x "/usr/bin/rgb-vplus" ]]; then |
96 | | - rgb-vplus --RedName=RED --GreenName=GREEN --BlueName=BLUE 2>/dev/null & |
| 98 | + rgb-vplus --RedName=RED --GreenName=GREEN --BlueName=BLUE >/dev/null 2>&1 & |
97 | 99 | log_message "Vplus RGB LED service started in background." |
98 | 100 | fi |
99 | 101 |
|
100 | 102 | # For fan control service |
101 | 103 | if [[ -x "/usr/bin/pwm-fan.pl" ]]; then |
102 | | - perl /usr/bin/pwm-fan.pl 2>/dev/null & |
| 104 | + perl /usr/bin/pwm-fan.pl >/dev/null 2>&1 & |
103 | 105 | log_message "Fan control service (pwm-fan.pl) started in background." |
104 | 106 | fi |
105 | 107 |
|
|
112 | 114 | # For pveproxy startup service |
113 | 115 | if [[ -n "$(dpkg -l | awk '{print $2}' | grep -w "^pve-manager$")" ]]; then |
114 | 116 | # Restarting systemd services can sometimes fail during early boot. |
115 | | - # Using '|| true' makes this step fault-tolerant. |
116 | | - (systemctl restart pveproxy) || true |
| 117 | + (systemctl restart pveproxy) & |
117 | 118 | log_message "PVE proxy service restart attempted." |
118 | 119 | fi |
119 | 120 |
|
120 | | -# For wxy-oec-turbo-4g board: Enable and restart getty on ttyS2 |
121 | | -if [[ "${FDT_FILE}" == "rk3566-wxy-oec-turbo-4g.dtb" ]]; then |
122 | | - (sudo systemctl enable getty@ttyS2 && sudo systemctl restart getty@ttyS2) || true |
123 | | - log_message "Getty service on ttyS2 restart attempted for wxy-oec-turbo-4g board." |
124 | | -fi |
125 | | - |
126 | 121 | # Finalization |
127 | 122 | log_message "All custom services have been processed." |
0 commit comments