Last active
February 22, 2016 15:15
-
-
Save monksy/c288d3a9f8d14dddd65b to your computer and use it in GitHub Desktop.
This gist is responsible for upgrading a system service (systemd) and going into the folder by it's specified user and performing a git pull. After the pull occures bring the service back up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| if [ $# -lt 3 ]; then | |
| echo "No arguments supplied." | |
| echo " Example: upgradeFoldByBash: [Service name] [service account] [folder]" | |
| exit 1 | |
| fi | |
| echo "Stopping the $1 Service" | |
| systemctl stop $1 | |
| echo "Performing the update." | |
| cd "$3" | |
| sudo -u "$2" git pull | |
| echo "Restarting the $1 Service" | |
| systemctl start $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment