Run Command (no root/plugin): Termux

by Alex Stoyanov

Version 5 (July 21, 2023)

Download (656 downloads)

๐Ÿ“ขThis flow starts a termux session and runs a command.

โœด๏ธDEFAULTS:
To easily setup Termux from a clean install, run the setup flow. If there is an error with the update, use "pkg upgrade -y" in the first variable.

The defaults show off a smooth setup process with good examples of how Termux can be utilized from AutoMate, without the use of the tasker plugin.

I have included 2 different ways of inputting commands and arguments to Termux. I prefer the method in the setup flow, since it can be used to pass entire scripts to Termux.

The default command is the yt-dlp (youtube-dlp) command, which takes a URL to a YouTube video, downloads the video, and extracts the audio at the best possible quality in "flac" format. The default URL is an NCS song (Warrior - Mortals: https://youtube.com/watch?v=yJg-Y5byMMw).

The default music_folder is set to a folder named "Music" on an SD card. You can change that path to any editable storage location. The path itself is specified via a relative path from the home folder to avoid any inconsistencies in SD card naming. For this to work, the termux-setup-storage command must have been run in advance.


โœด๏ธAny command can be specified instead of yt-dlp.

๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป
โ— Prerequisites:
โ€ข Latest version of Termux, preferably from F-Droid (https://f-droid.org/packages/com.termux/)
โ€ข display over other apps turned on for termux
๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ
๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ
โ•OPTIONAL (required for default code, included in setup flow):
โ€ข yt-dlp:
pkg upgrade
pkg install python ffmpeg
pip install yt-dlp

โ€ข storage access:
termux-setup-storage
๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ
๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น
โ”POSSIBLE REQUIREMENTS:
โ€ข battery saver turned off for termux
๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น๐Ÿ”น


โค๏ธHuge thanks to Micha on discord (leaving out the full tag for their privacy) for helping me figure out the syntax on the start service block

(PS check out my other flow https://llamalab.com/automate/community/flows/42089 to see a fully functioning implementation of this, or for a mostly automated termux setup process)

Reach me on discord: @griffy_cat
or telegram: @Grifdore

Version 2.1: changed default song to an NCS song just in case

Version 2: added user experience improvements and made process much smoother. Edited description for clarity.

4.7 average rating from 3 reviews

5 stars
2
4 stars
1
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.