#!/bin/bash

function bash_update() {
    echo $directory$filename $action
    rm -rf /opt/websites/just-the-docs/bash
    jekyll b -s /opt/apps/document/bash -d /opt/websites/just-the-docs/bash
}

function python_update() {
    echo $directory$filename $action
    rm -rf /opt/websites/just-the-docs/python
    jekyll b -s /opt/apps/document/python -d /opt/websites/just-the-docs/python
}


function blog_update() {
    echo $directory$filename $action
    rm -rf /opt/websites/blog
    jekyll b -s /opt/apps/blog/ -d /opt/websites/blog/
    echo -e '\n'
}


echo -e '\n\n==================================================================' >> /opt/logs/jekyll_update.log
date >> /opt/logs/jekyll_update.log
if [[ $1 == 'blog' ]]; then
    blog_update >> /opt/logs/jekyll_update.log
elif [[ $1 == 'python' ]]; then
    python_update >> /opt/logs/jekyll_update.log
elif [[ $1 == 'bash' ]]; then
    bash_update >> /opt/logs/jekyll_update.log
else
    echo Wrong >> /opt/logs/jekyll_update.log
    exit 2
fi



