Simple bash linux script to login and update web sites from Git repositories
We have some web sites which must be updated from Git repositories by users who have no other permissions on web server. For this task, I imported SSH key to server for authorizing on bitbucket and wrote a simple bash script for four different repos:
#!/bin/bash
while true; do
echo "Please choose api to update (enter number)"
select repo in "dev" "a" "b" "test" "EXIT"; do
case $repo in
dev ) cd /web/dev;echo "updating:";pwd;git pull origin master; break;;
a ) cd /web/a;echo "updating:";pwd;git pull origin master; break;;
b) cd /web/b;echo "updating:";pwd;git pull origin master; break;;
test ) cd /web/test;echo "updating:";pwd;git pull origin master; break;;
EXIT ) exit;break;;
esac
done
echo "Update finished. Want to update more?"
echo ""
done
This bash script is set as login shell for those users - so they can login and update their servers.