Shebang

The shebang marks the beginning of any UNIX script. Whether it’s shell, Perl, or Python, all scripts have it. Yes, I’ve finally started learning something. I was finally fed up with all of that manual updating of Planet Hosannaletheia and looked up how to write a shell script.

Basically a shell script is just a bunch of commands. You can set variables and use branching and looping if you need. I didn’t really use any of those decision things though since it was really simple (run this file and ftp everything up to the server). My life is now a tad easier though.

Here’s the script:
#!/bin/bash
# Planet Hosannaletheia update script
PLANET_DIR=/home/blkmage/site/planet-nightly
HOST='orangesimile.net'
USER='planet@orangesimile.net'
PASS='******'
cd $PLANET_DIR
python planet.py tjcac/config.ini
cd output
ftp -n $HOST <<end_script USER $USER
quote PASS $PASS
put index.html
put rss20.xml
put rss10.xml
put foafroll.xml
put opml.xml
quit
END_SCRIPT
date >> /home/blkmage/site/planet.log
echo "Planet Hosannaletheia updated" >> /home/blkmage/site/planet.log
exit

It is now cron’d, so Planet will update on the hour.

Leave a Reply