-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manual python script for pushing to webserver.
Type `./deploy.py` to run the script. Enter your username exactly how it is on the webserver. For example, `aaron`. Enter your password and...magic.
- Loading branch information
a-stjohn
committed
Feb 20, 2020
1 parent
b4db119
commit 0e2ac86
Showing
3 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.pythonPath": "/usr/bin/python3" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python3 | ||
import subprocess | ||
|
||
# Get Username | ||
username = input('Enter your username: ') | ||
|
||
allowed_users = ['aaron', 'tim', 'jt'] | ||
|
||
web_server_host = "docs1.tn.ixsystems.com" | ||
web_server_dir = "/var/www/html/docs1" | ||
|
||
rsync_target = username + "@" + web_server_host + ":" + web_server_dir | ||
|
||
rsync_command = ['rsync', '-avz', '--delete', 'public/', rsync_target] | ||
hugo_command = ['hugo', '-t', 'docsy', '-d', 'public', '--gc', '--minify', '--cleanDestinationDir'] | ||
|
||
|
||
# Conditional to check if user is allowed to run command | ||
if username.lower() in allowed_users: | ||
subprocess.run(hugo_command) | ||
subprocess.run(rsync_command) | ||
else: | ||
print('You do not have permission to run this script.') |