-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·43 lines (35 loc) · 798 Bytes
/
Copy pathdeploy
File metadata and controls
executable file
·43 lines (35 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
echo
echo "****Deployment Script by Rohitt Vashishtha****"
if [ $# != 2 ];
then
echo "Usage: deploy branch-name /absolute/path/to/your/web/content"
echo " use branch 'master' to deploy to apache2 home directory"
echo
exit 0
fi
branch=$1
path1="$2"
path="$path1/*"
destination="/var/www/html/$1"
if [ $branch == "master" ];
then
destination="/var/www/html"
fi
#script to deploy files on Apache2 Web Server
rm -r "$destination" 2>/dev/null
mkdir "$destination" 2>/dev/null
cp -R $path "$destination"
result=$?
if [ $result == 0 ];
then
echo "Deployment Successful For Branch $1!"
echo "Deployed $(find $path1 -type f -print | wc -l) Files From $path1"
echo
fi
if [ $result != 0 ];
then
echo "Deployment Failed For Branch $1!"
echo
rm -R "$destination"
fi