Linux for Radio Astronomy

Periodic screenshots and FTP for Ubuntu

Is there a program for Ubuntu which will take periodic screenshots and FTP to website?

Yes, you can achieve this on Ubuntu using a combination of existing tools. There isn’t a single monolithic program that does everything out of the box (periodic screenshots + FTP), but you can easily set it up with:


🔧 Tools You’ll Need

  1. gnome-screenshot (or scrot / import for alternatives) — to take screenshots.
  2. cron — to schedule periodic tasks.
  3. lftp — to upload via FTP (more reliable and scriptable than plain ftp).

🪜 Setup Guide

Step 1: Install required tools

sudo apt update
sudo apt install gnome-screenshot lftp

Or for lightweight alternative:

sudo apt install scrot lftp

Step 2: Create a script (e.g., ~/screenshot_upload.sh)

#!/bin/bash
 
# Set variables
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
FILE="/tmp/screenshot_$TIMESTAMP.png"
 
# Take screenshot
gnome-screenshot -f "$FILE"
# Alternative with scrot: scrot "$FILE"
 
# Upload to FTP
lftp -u yourusername,yourpassword ftp.yoursite.com <<EOF
cd /path/on/server
put $FILE
bye
EOF
 
# Optionally delete local file
rm "$FILE"

Make it executable:

chmod +x ~/screenshot_upload.sh

Step 3: Add to crontab

Edit your crontab:

crontab -e

Add a line like this to run every 5 minutes:

*/5 * * * * /home/youruser/screenshot_upload.sh

✅ Tips

  • Use an FTP account with limited privileges for safety.
  • You can change the FTP path or file name to always overwrite a single file if needed (like screenshot.png instead of timestamped).
  • If you’re using xfce, xfce4-screenshooter also works well and has CLI options.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.