88 lines
2.5 KiB
Bash
Executable File
88 lines
2.5 KiB
Bash
Executable File
#/bin/sh
|
|
|
|
month=$(date '+%m')
|
|
year=$(date '+%Y')
|
|
|
|
#
|
|
# Cluster
|
|
#
|
|
|
|
# Download the websites index HTML file
|
|
|
|
wget -O /sdf/arpa/ns/s/scm/index.html https://scm.sdf.org
|
|
|
|
# Download the websites posts HTML file
|
|
|
|
wget -O /sdf/arpa/ns/s/scm/$month.html https://scm.sdf.org/posts/$year/$month.html
|
|
|
|
# Remove the posts header line from the index HTML file
|
|
|
|
sed -i 's/<h3>Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html
|
|
|
|
# Remove the posts lines from the index HTML file
|
|
|
|
sed -i "s/<h4><a href="https\:\/\/scm.sdf.org\/posts\/{$year}\/{$month}.html">{$year}<\/a><\/h4>//" /sdf/arpa/ns/s/scm/index.html
|
|
|
|
# Convert the index HTML file to an index text file
|
|
|
|
html2text -o /sdf/arpa/ns/s/scm/index -ascii -style pretty /sdf/arpa/ns/s/scm/index.html
|
|
|
|
# Convert the posts HTML file to a text file
|
|
|
|
html2text -o /sdf/arpa/ns/s/scm/$month -ascii -style pretty /sdf/arpa/ns/s/scm/$month.html
|
|
|
|
# Remove the blank lines from the beginning of the index file
|
|
|
|
sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/index
|
|
|
|
# Remove the blank lines from the beginning of the posts file
|
|
|
|
sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/$month
|
|
|
|
# Remove the control characters from the index file
|
|
|
|
cat /sdf/arpa/ns/s/scm/index | col -b -x > /sdf/arpa/ns/s/scm/index.sdf
|
|
|
|
# Remove the control characters from the posts file
|
|
|
|
cat /sdf/arpa/ns/s/scm/$month | col -b -x > /sdf/arpa/ns/s/scm/$month.sdf
|
|
|
|
# Remove the control characters from the footer file
|
|
|
|
cat /sdf/arpa/ns/s/scm/footer | col -b -x > /sdf/arpa/ns/s/scm/footer.sdf
|
|
|
|
# Write the posts text file to the .plan cluster text file
|
|
# Change the head number as needed when the index.html file is changed
|
|
|
|
head -n 5 index.sdf > /sdf/arpa/ns/s/scm/header
|
|
cat /sdf/arpa/ns/s/scm/$month.sdf > body
|
|
cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/.plan
|
|
cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/.plan
|
|
cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan
|
|
|
|
# Write the index text file to the root directory of Gopher
|
|
|
|
cp /sdf/arpa/ns/s/scm/index.sdf /ftp/pub/users/scm/index
|
|
|
|
# Write the posts text file to the posts directory of Gopher
|
|
|
|
cp /sdf/arpa/ns/s/scm/$month.sdf /ftp/pub/users/scm/posts/$year/$month
|
|
|
|
# Set the proper Gopher directory permissions
|
|
|
|
chmod -R 754 /ftp/pub/users/scm
|
|
|
|
#
|
|
# Meta Array
|
|
#
|
|
|
|
scp /sdf/arpa/ns/s/scm/.plan scm@ma.sdf.org:/meta/s/scm
|
|
|
|
scp /sdf/arpa/ns/s/scm/header scm@ma.sdf.org:/meta/gemini/scm/index.gmi
|
|
|
|
cat /sdf/arpa/ns/s/scm/body | ssh scm@ma.sdf.org "cat >> /meta/gemini/scm/index.gmi"
|
|
|
|
scp /sdf/arpa/ns/s/scm/$month.sdf scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi
|
|
|
|
exit 0
|