Replace printf boot script with individual echo commands for mobile
printf \n escapes also get mangled by Android clipboard (expanded to real newlines). Individual echo >> commands are the only reliable approach for copy-pasting multi-line scripts to a mobile terminal. Bunker Admin
This commit is contained in:
@@ -162,16 +162,19 @@ This is **required** regardless of which method you use below:
|
||||
|
||||
Install [Termux:Boot](https://f-droid.org/packages/com.termux.boot/) from F-Droid (must be same source as Termux), then open it once to register with Android.
|
||||
|
||||
```bash
|
||||
# Create the boot scripts directory
|
||||
mkdir -p ~/.termux/boot
|
||||
Run each command one at a time (copy-paste friendly):
|
||||
|
||||
# Create the auto-start script (single command, no heredoc)
|
||||
printf '#!/data/data/com.termux/files/usr/bin/bash\nsource ~/.bashrc\ntermux-wake-lock\nmkdir -p ~/logs\nnohup python ~/sms-server/android/termux-sms-api-server.py >> ~/logs/sms-api.log 2>&1 &\n' > ~/.termux/boot/start-sms-server && chmod +x ~/.termux/boot/start-sms-server
|
||||
```bash
|
||||
mkdir -p ~/.termux/boot && echo '#!/data/data/com.termux/files/usr/bin/bash' > ~/.termux/boot/start-sms-server
|
||||
echo 'source ~/.bashrc' >> ~/.termux/boot/start-sms-server
|
||||
echo 'termux-wake-lock' >> ~/.termux/boot/start-sms-server
|
||||
echo 'mkdir -p ~/logs' >> ~/.termux/boot/start-sms-server
|
||||
echo 'nohup python ~/sms-server/android/termux-sms-api-server.py >> ~/logs/sms-api.log 2>&1 &' >> ~/.termux/boot/start-sms-server
|
||||
chmod +x ~/.termux/boot/start-sms-server
|
||||
```
|
||||
|
||||
!!! tip "Why printf instead of heredoc?"
|
||||
Heredoc (`<< 'EOF'`) blocks are unreliable when copy-pasting on mobile devices — trailing whitespace or clipboard quirks prevent the `EOF` from being recognized. The `printf` one-liner is more reliable for mobile copy-paste.
|
||||
!!! tip "Why individual echo commands?"
|
||||
Heredocs and `printf` with `\n` are unreliable when copy-pasting to a mobile terminal — the clipboard mangles escape sequences or adds trailing whitespace. Individual `echo >>` commands are the most reliable approach for mobile copy-paste.
|
||||
|
||||
#### C. Watchdog (auto-restart on crash)
|
||||
|
||||
@@ -193,9 +196,11 @@ The watchdog:
|
||||
For maximum reliability, use the watchdog as your boot script:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.termux/boot
|
||||
|
||||
printf '#!/data/data/com.termux/files/usr/bin/bash\ntermux-wake-lock\ncd ~/sms-server/android\nnohup bash sms-watchdog.sh >> ~/logs/watchdog.log 2>&1 &\n' > ~/.termux/boot/start-sms-server && chmod +x ~/.termux/boot/start-sms-server
|
||||
mkdir -p ~/.termux/boot && echo '#!/data/data/com.termux/files/usr/bin/bash' > ~/.termux/boot/start-sms-server
|
||||
echo 'termux-wake-lock' >> ~/.termux/boot/start-sms-server
|
||||
echo 'cd ~/sms-server/android' >> ~/.termux/boot/start-sms-server
|
||||
echo 'nohup bash sms-watchdog.sh >> ~/logs/watchdog.log 2>&1 &' >> ~/.termux/boot/start-sms-server
|
||||
chmod +x ~/.termux/boot/start-sms-server
|
||||
```
|
||||
|
||||
#### D. Quick Background (simplest)
|
||||
|
||||
Reference in New Issue
Block a user