Run Command (no root/plugin): Termux

by Alex Stoyanov

Version 2 (April 7, 2022)

Download (69 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 very smooth setup process with good examples of how Termux can be utilized from AutoMate, without the use of the tasker plugin. Almost every part of the flow is extremely reusable. I have also shown 2 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 for the song "Opiateยฒ" by Tool.

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.

๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป๐Ÿ”ป
โ—REQUIREMENTS:
โ€ข Latest version of Termux from F-Droid
โ€ข allow-external-apps permission set to true:
echo "allow-external-apps = true" >> ~/.termux/termux.properties
termux-reload-settings

โ€ข "Run commands in Termux environment" permission set to true in automate permissions

โ€ข display over other apps turned on for termux
๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ๐Ÿ”บ
๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ๐Ÿ”ธ
โ•OPTIONAL (required for default code, covered 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 paste the contents of the clipboard set block after the args in the run service block to run the command in the background. Not recommended if you want to be able to see the progress or results of the command)

5.0 average rating from 2 reviews

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

Rate and review within the app in the Community section.