Browse Source

cleanin up

master
trav 2 months ago
parent
commit
8df8978357
  1. 17
      README.md
  2. 8
      sexoskeleton.sh

17
README.md

@ -1,6 +1,9 @@
# bashblog
It's basically a cron-ed bash script that makes a "blog" from a folder of images and text. It is not perfect by any means, it is a blog by the simplest means. If you have questions feel free to email hello@sexoskeleton.com
## setup
1. create a `webadd` directory and a `webdir` directory. Webdir is the site, webadd is images and text to be added.
@ -19,6 +22,9 @@ when index.html gets bigger than `MAXINDEX`, index.html is renamed `$currentdate
`MAXLOG` sets how many lines of the script log you want to hold onto before it is deleted.
By default everytime sexoskeleton.sh is run it stores most of its output into `~/cronlog.log` which isn't precisely a cronlog. But that's what it's called.
## when the script is run
The script iterates through files in the `webadd` directory. Anything ending in .gif, .jpg, .png or .txt will be picked up. .txt files can contain html but you need to escape your own slashes. Which is to say if you put in / in a .txt add a \ before it.
@ -30,4 +36,15 @@ if nothing has changed the site is not re-uploaded
if something has changed, the script runs [surge](https://surge.sh) to upload the site. You'll need to configure Surge before running all this. Or just share `webdir` with a webserver.
## automate that shit
you probs want to add this script to your crontab so it auto checks for new images and adds them.
## troubleshooting
If you run into a `Syntax error: "(" unexpected` error you gotta run it as `./sexoskeleton.sh` and not `sh sexoskeleton.sh`
(see [stackexchance](https://unix.stackexchange.com/questions/253892/syntax-error-unexpected-when-creating-an-array))
This script was written by [trav](https://teafry.me)

8
sexoskeleton.sh

@ -1,4 +1,3 @@
#!/bin/bash
#sexoskeleton.com update script by trav fryer
echo "SEXOSKELETONZ INCOMMING"
@ -64,10 +63,10 @@ afile=${arr[0]}
#POST ALL THE FILES!!
while [ "$filez" != "" ]
do
#get extension of top file
#get extension of top file (this is not the best way to get file extension, it's not using the period as a delimiter!!
extn="${afile: -4}"
# test for image or txt
if [ "$extn" == '.png' ] || [ "$extn" = '.jpg' ] || [ "$extn" == '.gif' ]
if [ "$extn" == '.png' ] || [ "$extn" = '.jpg' ] || [ "$extn" == '.gif' ] || [ "$extn" == 'jpeg' ]
then
echo "posting $afile" | tee -a ~/cronlog.log
#come up with unique string to rename the file (to avoid colisions)
@ -88,6 +87,9 @@ do
insert="<!--posts-->\n$(date)<br><p>$str<\/p><br><br><br>\n"
sed -i -- "s/<!--posts-->/$insert/" "$file"
didsomethingchange=true
else
echo "BAD FILE EXTENSION $extn , REMOVING FILE $afile" | tee -a ~/cronlog.log
rm webadd/$afile
fi
# i t e r a t e
#get all files in webadd

Loading…
Cancel
Save