Added SQL rss feed, Fixed regex for image, and scp files to hpr server

This commit is contained in:
2025-09-11 17:50:31 +02:00
parent 16afecfb82
commit 2b4ef438b3
2 changed files with 88 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ last_update_txt="${sql_save_dir}/last_update.txt"
hpr_full_sql="${sql_save_dir}/hpr_hpr_full.sql"
hpr_site_sql="${sql_save_dir}/hpr.sql"
full_mysqldump_sql="${sql_save_dir}/mysqldump.sql"
hpr_database_file="hackerpublicradio.org/public_html/hpr.sql"
sync_delay_seconds="300" # 5 minutes
@@ -143,14 +144,51 @@ fi
mysqldump --defaults-file="${credential_file}" --tz-utc --add-drop-database --databases hpr_hpr> "${full_mysqldump_sql}"
tail "${full_mysqldump_sql}" | grep 'Dump completed on'
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss xmlns:atom=\"https://www.w3.org/2005/Atom\" version=\"2.0\">
<channel>
<title>Hacker Public Radio ~ Database Feed</title>
<link>http://hackerpublicradio.org/about.html</link>
<description>This Feed provides information the latest version of the HPR database.</description>
<language>en-us</language>
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback.nospam@nospam.hackerpublicradio.org (HPR Feedback)</managingEditor>
<webMaster>admin.nospam@nospam.hackerpublicradio.org (HPR Webmaster)</webMaster>
<generator>https://repo.anhonesthost.net/HPR/hpr-tools/src/branch/main/workflow/hpr_db_backup.bash</generator>
<docs>https://www.rssboard.org/rss-specification</docs>
<ttl>15</ttl>
<image>
<url>http://hackerpublicradio.org/images/hpr_feed_small.png</url>
<title>Hacker Public Radio ~ Database Feed</title>
<link>http://hackerpublicradio.org/about.html</link>
<description>The Hacker Public Radio Old Microphone Logo</description>
<height>164</height>
<width>144</width>
</image>
<atom:link href=\"https://hackerpublicradio.org/hpr.sql.rss\" rel=\"self\" type=\"application/rss+xml\"/>
<pubDate>$( date --utc --rfc-email )</pubDate>
<item>
<title>Export of the Public mariadb SQL for ${live_db_last_update_iso8601}</title>
<author>admin.nospam@nospam.hackerpublicradio.org (Janitors)</author>
<link>http://hackerpublicradio.org/hpr.sql#${live_db_last_update_iso8601}</link>
<description/>
<pubDate>$( date --utc --rfc-email )</pubDate>
<enclosure url=\"http://hackerpublicradio.org/hpr.sql#${live_db_last_update_iso8601}\" length=\"$( ls -al "${hpr_site_sql}" | awk '{print $5}' )\" type=\"application/sql\"/>
<guid isPermaLink=\"false\">sha1sum:$( sha1sum "${hpr_site_sql}" | awk '{print $1}' ),md5sum:$( md5sum "${hpr_site_sql}" | awk '{print $1}' )</guid>
</item>
</channel>
</rss>" > "${hpr_site_sql}.rss"
if [ $HOSTNAME = "whp01.cloud-hosting.io" ]
then
cp -v "${hpr_site_sql}" $HOME/hackerpublicradio.org/public_html/hpr.sql
cp -v "${hpr_site_sql}" "$HOME/${hpr_database_file}"
cp -v "${hpr_site_sql}.rss" "$HOME/${hpr_database_file}.rss"
else
rsync -av --partial --progress ${hpr_site_sql} hpr:hackerpublicradio.org/public_html/hpr.sql
rsync -av --partial --progress ${hpr_site_sql} hpr:${hpr_database_file}
rsync -av --partial --progress ${hpr_site_sql}.rss hpr:${hpr_database_file}.rss
fi
echo "${live_db_last_update_iso8601}" > "${last_update_txt}"
echo "Finished export of \"${live_db_last_update_iso8601}\""