Skip to content

Instantly share code, notes, and snippets.

@acedesigns
Last active August 29, 2015 14:26
Show Gist options
  • Save acedesigns/484dfe5345f67ff8d6dd to your computer and use it in GitHub Desktop.
Save acedesigns/484dfe5345f67ff8d6dd to your computer and use it in GitHub Desktop.
A simple script to try and Automate the Git process of changing directory, Statuses, Pulling ... etc
#!/bin/bash
# https://gist.github.com/acedesigns/484dfe5345f67ff8d6dd
# Read more about directories in bash scriptitng
# http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
# PURPOSE :: To try and automate the git commands.
# We will change to our project folder and then check for changes to any file
# within the folder structure.
# Our Project Dir
OURDIR="/var/www/html/AngulrJsTut"
if [ -d "$OURDIR" ]; then
echo 'Directory found ' $OURDIR
# cd and do Git Stuff
cd $OURDIR && git status && git pull
else
echo 'Directory not found'
# Create the Dir
mkdir $OURDIR
fi
# First make the script executable chmod +x gitAutomator.sh
# To execute this file cd to its location and run either . gitAutomator.sh or sudo bash gitAutomator.sh
# In the future We want to let the system to run this file every 3 hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment