If you are using an old Android phone as a Jellyfin media server, you probably don’t want to start Jellyfin manually every time the phone restarts.
Termux:Boot can solve this by running a startup script automatically when Android finishes booting. We can use it to start Jellyfin and enable a wake lock so the phone is less likely to enter a state that interrupts the server.
This guide continues our earlier tutorial on installing Jellyfin on Android using Termux. Make sure Jellyfin is already installed and working before proceeding.
1. Install Termux:Boot
Termux:Boot is a separate Android app that works alongside Termux. It runs scripts stored in a specific folder whenever the device boots.
Download Termux:Boot from the same source you used to install Termux. If you installed Termux from F-Droid, install Termux:Boot from F-Droid. If you use the official Termux GitHub releases, download the corresponding Termux:Boot APK from its official GitHub releases page.
Note: When you try to install the downloaded APK, Android may display a security warning because the app was downloaded outside the Google Play Store. Tap More to view the additional options, then select Install anyway to continue, provided you downloaded the APK from the official Termux source.
Make sure Termux and Termux:Boot are installed from the same source. Mixing APKs signed by different sources can cause installation problems.
After installing Termux:Boot, open the app once. You don’t need to configure anything inside it. This initial launch enables its boot functionality.
2. Create the Boot Script Folder
Next, open Termux and create the directory where Termux:Boot looks for startup scripts.
Run:
mkdir -p ~/.termux/boot
This creates the boot directory inside Termux’s .termux folder if it doesn’t already exist.
Any executable scripts placed in this directory will be run when Android finishes booting. If you have multiple scripts, Termux:Boot runs them in alphabetical order.
3. Create a Startup Script for Jellyfin
Now we need to create a script that starts Jellyfin automatically when Termux:Boot runs.
Open Termux and create the startup script:
nano ~/.termux/boot/start-jellyfin
Paste the following contents:
#!/data/data/com.termux/files/usr/bin/bash
export PREFIX="/data/data/com.termux/files/usr"
export HOME="/data/data/com.termux/files/home"
export PATH="$PREFIX/bin:$PATH"
export DOTNET_ROOT="$PREFIX/lib/dotnet"
export DOTNET_ROOT_ARM64="$PREFIX/lib/dotnet"
termux-wake-lock
sleep 30
jellyfin --ffmpeg "$PREFIX/bin/ffmpeg" &
The environment variables are important because Jellyfin depends on the .NET runtime. When Termux:Boot launches the script, it may not inherit the same environment as a normal Termux session. Setting these paths explicitly allows Jellyfin to locate the installed .NET runtime and FFmpeg.
The termux-wake-lock command helps prevent the device from entering a sleep state that could interrupt the server. The 30-second delay gives Android and Termux time to initialise before Jellyfin starts.
The & at the end runs Jellyfin in the background, allowing the startup script to finish without waiting for Jellyfin to exit.
Save the Script
Save the file by pressing CTRL + O, then press Enter to confirm the filename. Press CTRL + X to exit Nano.
Make the Script Executable
Run:
chmod +x ~/.termux/boot/start-jellyfin
Your startup script is now ready.

4. Configure Android Battery Settings
Android may restrict background activity to save battery. These restrictions can prevent Termux or Termux:Boot from running reliably.
Open your phone’s Settings and find the battery management options.
Set battery usage for both Termux and Termux:Boot to Unrestricted, or select the equivalent option that allows background activity.
Some Android phones also provide an Auto-start or Background launch permission. If available, enable it for these apps.
The exact settings vary depending on the Android version and phone manufacturer.
5. Restart Your Phone and Test Jellyfin
Now restart your Android phone. You don’t need to open Termux manually.
After Android finishes booting and you unlock the phone, Termux:Boot should execute the startup script, wait for 30 seconds, and launch Jellyfin.
Open the Jellyfin app or a browser on another device connected to your home network. Enter your Android phone’s local IP address followed by port 8096.
For example:
http://192.168.1.100:8096
Replace the example IP address with your phone’s actual local IP address.
If the Jellyfin dashboard opens, automatic startup is working. Try playing a video to confirm that media playback is also working.
Important: Android Lock Screen
There is one limitation to keep in mind. On our test device, Jellyfin did not start until the phone was unlocked after restarting.
If your Android phone has a PIN, password, or pattern lock, you will need to unlock it once after every reboot before Jellyfin can start.
If you want the server to become available automatically after a reboot without manually unlocking the phone, you can remove the screen lock by setting it to None or Swipe in Android security settings.
Be aware that removing your PIN or password reduces your phone’s security. Anyone with physical access to the device may be able to access its contents.
A Note About Background Reliability
Termux:Boot starts Jellyfin after the phone reboots, but Android may still terminate background processes due to battery management or memory restrictions.
For better reliability, keep the phone connected to a charger and allow unrestricted background activity for Termux and Termux:Boot.
The wake lock helps keep the server running while the screen is off, but it cannot guarantee uninterrupted operation.


