Home / Blog / DevOps / Article

📱

Introduction

Termux turns Android into a powerful Linux environment. Combined with automation scripts, it can handle server monitoring, scheduled backups, and even CI/CD triggers — all from your phone. This guide covers practical, production-used scripts.

Setting Up Termux

Initialize Termux with the essential packages: ```bash # Update and install core tools pkg update && pkg upgrade -y # Essential packages pkg install -y termux-api openssh python nodejs-lts git\ cronie curl jq tmux neovim ripgrep # Request storage permission termux-setup-storage # Start SSH server sshd # Connect: ssh -p 8022 u0_aXXX@ ```

Automated Server Health Monitoring

A script that checks your server every 5 minutes and sends a notification if it's down: ```bash #!/data/data/com.termux/files/usr/bin/bash # server-monitor.sh SERVERS=( "194.164.148.37:443" "api.example.com:443" ) for SERVER in "${SERVERS[@]}"; do HOST="${SERVER%%:*}" PORT="${SERVER##*:}" if timeout 10 bash -c "echo >/dev/tcp/$HOST/$PORT" 2>/dev/null; then echo "$(date): $HOST:$PORT is UP" >> ~/logs/health.log else termux-notification --title "🚨 Server Down!" \ --content "$HOST:$PORT is unreachable" \ --priority high \ --vibrate 1000 echo "$(date): $HOST:$PORT is DOWN!" >> ~/logs/health.log fi done # Schedule with cronie: # crontab -e # */5 * * * * ~/scripts/server-monitor.sh ```

SSH Key-Based Deployments from Phone

Deploy code directly from Termux: ```bash #!/bin/bash # deploy.sh — trigger deployment on server SSH_HOST="root@194.164.148.37" SSH_PORT=22 # Deploy via SSH ssh -p $SSH_PORT $SSH_HOST << 'EOF' cd /var/www/pravidhisolutions.in git pull origin main # Or trigger a webhook curl -X POST https://api.example.com/deploy \ -H "Authorization: Bearer $DEPLOY_TOKEN" \ -d '{"branch":"main"}' EOF termux-notification --title "✅ Deploy Complete" \ --content "Site deployed successfully at $(date)" ```

Automated Database Backups

Dump databases to cloud storage: ```bash #!/bin/bash # db-backup.sh TIMESTAMP=$(date +%Y%m%d_%H%M%S) BACKUP_DIR=~/storage/shared/backups DB_HOST="your-server.com" DB_NAME="mydb" # Create backup directory mkdir -p $BACKUP_DIR # SSH into server and dump database ssh root@$DB_HOST "pg_dump -Fc $DB_NAME" > $BACKUP_DIR/db_$TIMESTAMP.dump # Compress gzip $BACKUP_DIR/db_$TIMESTAMP.dump # Keep only last 7 days find $BACKUP_DIR -name "*.dump.gz" -mtime +7 -delete termux-notification --title "💾 Backup Complete" \ --content "Database saved: db_$TIMESTAMP.dump.gz ($(du -h $BACKUP_DIR/db_$TIMESTAMP.dump.gz | cut -f1))" ```

Scheduled Content Publishing

Automate blog publishing from your notes: ```bash #!/bin/bash # publish.sh ARTICLE=$1 if [ -z "$ARTICLE" ]; then echo "Usage: ./publish.sh " exit 1 fi # Convert markdown to HTML (requires pandoc) # Then scp to server scp -P 22 "$ARTICLE.md" root@194.164.148.37:/var/www/pravidhisolutions.in/blog/ termux-notification --title "📝 Article Published" \ --content "$ARTICLE has been deployed" ```

System Info Dashboard

Quick server overview from Termux: ```bash #!/bin/bash # server-status.sh ssh root@194.164.148.37 << 'EOF' echo "═══════════════════════════════" echo " SERVER STATUS DASHBOARD" echo "$(date)" echo "═══════════════════════════════" echo "▶ Uptime: $(uptime -p)" echo "▶ Memory: $(free -h | awk '/^Mem:/ {print $3"/"$2}')" echo "▶ Disk: $(df -h / | awk 'NR==2 {print $3"/"$2}')" echo "▶ Load: $(uptime | awk -F'load average:' '{print $2}')" echo "▶ Nginx: $(systemctl is-active nginx)" echo "▶ Docker: $(docker ps --format '{{.Names}} ({{.Status}})' | tr '\n' ', ')" echo "═══════════════════════════════" EOF ```

Conclusion

Termux transforms your Android device into a portable DevOps workstation. Combine these scripts with cronie scheduling for a fully automated operations toolkit that runs from your pocket.

Published on June 7, 2026 · Filed under DevOps

← Back to Blog