Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active May 14, 2024 03:46
Show Gist options
  • Save dewomser/4edba1be1f73c8ed1c785a2244ad374a to your computer and use it in GitHub Desktop.
Save dewomser/4edba1be1f73c8ed1c785a2244ad374a to your computer and use it in GitHub Desktop.
mastodon toot a photostream make and destroy toots in a time intervall
#!/bin/bash
#crontab
#for crontab use always full path or EXPORT
#crontabline : */15 * * * * /home/user_name/bin/stream_ordner/toot_a_photostream.sh >/home/user_name/bin/stream_ordner/error.txt 2>&1
fullpath_dir="/home/foo/bin/stream"
fullpath_toot="/usr/bin/toot"
mkdir -p $fullpath_dir/"$(date +%m_%d_%y)"
source_url="https://webcams.foo_bar.de/Webcam1/webcam/current.jpg"
toottext="Mein Text $(date +%H:%M) . Alle 15 Minuten ein Schnappschuss!"
tootid="$(cat $fullpath_dir/toot_id.txt)"
#sleep 100
if [ -z "$tootid" ]; then
echo "still no ID"
else
$fullpath_toot delete $tootid
fi
sleep 1
/usr/bin/wget --no-use-server-timestamps $fullpath_dir/$(date +%m_%d_%y) $source_url -O $fullpath_dir/$(date +%m_%d_%y)/$(date +%H_%M).jpg
tooturl="$(echo "$toottext"| $fullpath_toot post --media $fullpath_dir/$(date +%m_%d_%y)/$(date +%H_%M).jpg)"
echo "${tooturl##*/}" > $fullpath_dir/toot_id.txt
@dewomser
Copy link
Author

Nochmal dran rumgemurkst. Jetzt wird automatisch ein Ordner für die Fotos erzeugt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment