2023-02-11 10:33:40 -05:00
|
|
|
#/bin/ksh
|
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
month=$(date '+%m')
|
|
|
|
year=$(date '+%Y')
|
|
|
|
|
2023-02-14 17:52:30 -05:00
|
|
|
#
|
2023-02-13 14:54:06 -05:00
|
|
|
# Cluster
|
2023-02-14 17:52:30 -05:00
|
|
|
#
|
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Download the websites index HTML file
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-11 10:33:40 -05:00
|
|
|
wget -O /sdf/arpa/ns/s/scm/index.html https://scm.sdf.org
|
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Download the websites posts HTML file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-16 16:49:03 -05:00
|
|
|
wget -O /sdf/arpa/ns/s/scm/$month.html https://scm.sdf.org/posts/$year/$month.html
|
2023-02-14 14:26:18 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Remove the post related lines from the index HTML file
|
2023-02-15 16:56:36 -05:00
|
|
|
|
2023-02-16 20:47:37 -05:00
|
|
|
sed -i 's/<h3>Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html
|
2023-02-15 16:56:36 -05:00
|
|
|
|
2023-02-16 21:39:11 -05:00
|
|
|
# This line works as it is but ideally the year and month would use
|
|
|
|
# variables. I don't know how to this yet and will move forward.
|
|
|
|
|
2023-02-16 20:47:37 -05:00
|
|
|
sed -i 's/<h4><a href="https\:\/\/scm.sdf.org\/posts\/2023\/02.html">2023<\/a><\/h4>//' /sdf/arpa/ns/s/scm/index.html
|
2023-02-15 16:56:36 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Convert the index HTML file to an index text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-14 13:52:55 -05:00
|
|
|
html2text -o /sdf/arpa/ns/s/scm/index -ascii -style pretty /sdf/arpa/ns/s/scm/index.html
|
2023-02-11 10:33:40 -05:00
|
|
|
|
2023-02-15 19:56:01 -05:00
|
|
|
# Convert the posts HTML file to a text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
html2text -o /sdf/arpa/ns/s/scm/$month -ascii -style pretty /sdf/arpa/ns/s/scm/$month.html
|
2023-02-14 14:26:18 -05:00
|
|
|
|
2023-02-15 19:56:01 -05:00
|
|
|
# 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
|
|
|
|
|
2023-02-16 16:49:03 -05:00
|
|
|
sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/$month
|
2023-02-15 19:56:01 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the index text file to the .plan text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-19 22:15:55 -05:00
|
|
|
#cat /sdf/arpa/ns/s/scm/index > /sdf/arpa/ns/s/scm/.plan
|
2023-02-11 10:33:40 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the posts text file to the .plan cluster text file
|
2023-02-19 22:15:55 -05:00
|
|
|
# Researching how best to do this yeilded a lot of interesing results. After
|
|
|
|
# some thinking, I decided this was the best way, as it's readable and I
|
|
|
|
# think will be easy to modify as needed
|
|
|
|
|
2023-02-21 11:09:55 -05:00
|
|
|
head -n 9 index > /sdf/arpa/ns/s/scm/header
|
2023-02-19 22:15:55 -05:00
|
|
|
|
|
|
|
cat /sdf/arpa/ns/s/scm/$month > body
|
|
|
|
|
2023-02-21 10:42:52 -05:00
|
|
|
cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/.plan
|
2023-02-19 22:15:55 -05:00
|
|
|
|
2023-02-21 10:42:52 -05:00
|
|
|
cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/.plan
|
2023-02-19 22:15:55 -05:00
|
|
|
|
2023-02-21 10:42:52 -05:00
|
|
|
cat /sdf/arpa/ns/s/scm/footer >> /sdf/arpa/ns/s/scm/.plan
|
2023-02-15 19:56:01 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the index text file to the root Gopher location
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-14 18:35:14 -05:00
|
|
|
cp /sdf/arpa/ns/s/scm/index /ftp/pub/users/scm
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the posts text file to the posts Gopher location
|
2023-02-14 14:26:18 -05:00
|
|
|
|
2023-02-16 16:49:03 -05:00
|
|
|
cp /sdf/arpa/ns/s/scm/$month /ftp/pub/users/scm/posts/$year
|
2023-02-14 18:35:14 -05:00
|
|
|
|
2023-02-15 19:56:01 -05:00
|
|
|
# Set the proper Gopher directory permissions
|
|
|
|
|
2023-02-14 18:35:14 -05:00
|
|
|
chmod -R 754 /ftp/pub/users/scm
|
2023-02-14 14:37:49 -05:00
|
|
|
|
2023-02-14 17:52:30 -05:00
|
|
|
#
|
2023-02-13 14:54:06 -05:00
|
|
|
# Meta Array
|
2023-02-14 17:52:30 -05:00
|
|
|
#
|
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Remove all control characters from the index text file and write it to the index MA text file
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-14 14:06:07 -05:00
|
|
|
cat /sdf/arpa/ns/s/scm/index | col -b -x > /sdf/arpa/ns/s/scm/index.ma
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Remove all the control characters from the posts text file and write it to the MA text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
cat /sdf/arpa/ns/s/scm/$month | col -b -x > /sdf/arpa/ns/s/scm/$month.ma
|
2023-02-14 16:44:59 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the MA index text file to the .plan text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-14 13:52:55 -05:00
|
|
|
scp /sdf/arpa/ns/s/scm/index.ma scm@ma.sdf.org:/meta/s/scm/.plan
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the MA index text file to the Gemini index text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-14 13:52:55 -05:00
|
|
|
scp /sdf/arpa/ns/s/scm/index.ma scm@ma.sdf.org:/meta/gemini/scm/index.gmi
|
2023-02-13 14:54:06 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
# Write the MA posts text file to the Gemini posts text file
|
2023-02-14 17:52:30 -05:00
|
|
|
|
2023-02-16 12:05:10 -05:00
|
|
|
scp /sdf/arpa/ns/s/scm/$month.ma scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi
|
2023-02-14 16:44:59 -05:00
|
|
|
|
2023-02-11 10:33:40 -05:00
|
|
|
exit 0
|