Termux-services

termux-services contains a set of scripts for controlling services. Instead of putting commands in ~/.bashrc or ~/.bash_profile, they can be started and stopped with termux-services.

Supported services
PackageDaemonPortDescription
apache2httpd8080Apache Web Server HTTP Web Server
atatdAT and batch delayed command scheduling utility and daemon at
bitcoinbitcoindBitcoin Core
busyboxtelnetd8023Remote terminal service Telnet
busyboxftpd8021FTP (File Transfer Protocol) FTP
croniecrondDaemon that runs specified programs at scheduled times cron
emacsemacsdExtensible, customizable text editor-and more EMACS
ipfsipfsA peer-to-peer hypermedia distribution protocol IPFS
libmosquittomosquitto1883MQTT is a lightweight, publish-subscribe network protocol MQTT
lighttpdlighttpd8080Lighttpd Small webserver HTTP Web Server
lndlndLightning Network Daemon
mariadbmysqld3306MariaDB Community-developed fork of the MySQL from its original authors
mpdmpdMusic Player Daemon (MPD)
mpdscribblempdscribbleMPD client which submits tracks being played
nginxnginx8080NGINX Web server HTTP Web Server
opensshsshd8022OpenSSH SSH
postgresqlpostgres5432PostgreSQL database PostgreSQL
privoxyprivoxyPrivoxy is non-caching web proxy with advanced filtering capabilities HTTP Proxy
tortorThe Onion Router anonymizing overlay network Tor
transmissiontransmissionBitTorrent client BitTorrent


To install termux-services, run

pkg install termux-services

and then restart termux so that the service-daemon is started.

To then enable and run a service, run

sv-enable <service>

If you only want to run it once, run

sv up <service>

To later stop a service, run:

sv down <service>

Or to disable it

sv-disable <service>

A service is disabled if `$PREFIX/var/service/<service>/down` exists, so the `sv-enable` and `sv-disable` scripts touches, or removes, this file.

termux-services uses the programs from runit to control the services. A bunch of example scripts are available from the same site. If you find a script you want to use, or if you write your own, you can use set it up by running:

mkdir -p $PREFIX/var/service/<PKG>/log
ln -sf $PREFIX/share/termux-services/svlogger $PREFIX/var/service/<PKG>/log/run

and then put your run script for the package at $PREFIX/var/service/<PKG>/run and make sure that it is runnable.

You can then run

sv up <PKG>

to start it.

Log files for services are situated in $PREFIX/var/log/sv/<PKG>/ with the active log file named "current".

Starting termux-services on boot

If you want your services to start on device boot, see the example in Termux:Boot

This article is issued from Termux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.