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 | |
| # Created by Jeffery Grantham 01/07/2019 | |
| # Purpose: Easily implement 301 redirects into website conf files | |
| # Written for use with apache only | |
| # Usage: 301.sh [.conf file] | |
| FILE=$1 | |
| cd /etc/apache2/sites-available/ | |
| sed "/CustomLog/a\ \tRedirect 301 / https://$FILE.com/" $FILE.conf> tempfile && mv tempfile $FILE.conf | |
| cat $FILE.conf |
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 | |
| # Created by Jeffery Grantham with assistance from Jimmy Burrell on February 5, 2019 | |
| # Usage: <command> | slack <channel> <username to display> | |
| # If username is not included, it will default to the username "Admin." | |
| # Designed to pipe stdout in a slack message to any one of the predefined channels | |
| i="$1" | |
| cron="(webhook url here)" | |
| general="(webhook url here)" | |
| random="(webhook url here)" |
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 | |
| # Return gateway settings to default if floating IP is not active | |
| # Script must be run as root | |
| NET_INT="eth0" | |
| CURL_TIMEOUT=3 | |
| # Check there's a floating IP attached to this droplet | |
| if [ "$(curl -s --connect-timeout $CURL_TIMEOUT http://169.254.169.254/metadata/v1/floating_ip/ipv4/active)" == "true" ]; then | |
| echo "This droplet has a floating IP assigned to it." |
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 | |
| # Created by Jeffery Grantham 1/8/2019 | |
| # Usage: piholeimgmount.sh [image] | |
| # This script assumes that you've already made a folder under /mnt called loop | |
| # It will attempt to create the directory if it is not found. | |
| # If it fails, the user account running the script does not have rights to do so. | |
| # This script will not work with berryboot installed images. | |
| # It is only designed to work with raspbian-based images as it has already calculated | |
| # the offset at which your Linux partition begins |
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 | |
| # Force outbound traffic through the attached floating IP | |
| # Script must be run as root | |
| NET_INT="eth0" | |
| CURL_TIMEOUT=3 | |
| echo -n "Setting floating IP as the default gateway: " | |
| # Check there's a floating IP attached to this droplet |
NewerOlder