Last active
October 26, 2019 12:17
-
-
Save uneasyguy/dd0e0ff5163e06c889d104b4215e8b50 to your computer and use it in GitHub Desktop.
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/bash | |
sudo apt-get update ##update package list | |
sudo apt-get upgrade -y ##install newest packages, y flag assumes your answer is yes on any prompts | |
sudo apt-get install wget ##installl wget to download sample pdf | |
for package in python3-pip nodejs npm ##install nodejs, node package manager and python package manager | |
do | |
sudo apt install $package -y | |
done | |
for package in flask flask-restful PyPDF2 getgist python-crontab ##install needed python packages | |
do | |
sudo -H pip3 install $package | |
done | |
for directory in ~/appscript ~/appscript/pdfs ##make directories for app | |
do | |
mkdir $directory | |
done | |
sudo npm install forever -g ##install forever to start app on startup/constantly monitor while running/restart the app in the event it breaks, g flag tells to npm to install globally for command line access | |
for gist in rc.local rc-local.service merge.sh merge_app.py merge_app_setup.py forever_all.sh #download gist files | |
do | |
getgist uneasyguy $gist | |
done | |
for file in merge.sh forever_all.sh merge_app_setup.py ##modify these files to become executable | |
do | |
chmod a+x $file | |
done | |
./merge_app_setup.py ##run setup assistant python script which finds/replaces generic text in the previously downloaded gists,sets up cronjob mentioned above, moves rc.local&rc-local.service to their destinations, and ensures all files under the users home drive have correct ownership permissions | |
sudo chmod +x /etc/rc.local ##modify new rc.local filel to be executable | |
sudo systemctl enable rc-local.service ##enable new rc.local service to be executed on next startup | |
mv merge_app.py ~/appscript/ ##move primary python script into its intended destination | |
wget https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf ##download sample pdf | |
mv dummy.pdf ~/appscript/ ##move sample pdf | |
rm merge_app_setup.py ##remove no longer needed python setup assistant | |
rm merge_app_setup.sh ##delete this file, will still finish initial execution | |
sudo reboot ##restart server to ensure app starts up on startup, you can run the command forever list to check if it is running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment