commit
41c8cb76fa
7 changed files with 112 additions and 2 deletions
@ -0,0 +1,46 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
# This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection. |
||||||
|
# Special thanks to mfox for his ps script |
||||||
|
# https://github.com/markafox/GoDaddy_Powershell_DDNS |
||||||
|
# |
||||||
|
# First go to GoDaddy developer site to create a developer account and get your key and secret |
||||||
|
# |
||||||
|
# https://developer.godaddy.com/getstarted |
||||||
|
# Be aware that there are 2 types of key and secret - one for the test server and one for the production server |
||||||
|
# Get a key and secret for the production server |
||||||
|
# |
||||||
|
#Update the first 4 variables with your information |
||||||
|
|
||||||
|
domain="########" # your domain |
||||||
|
name="########" # name of A record to update |
||||||
|
key="########" # key for godaddy developer API |
||||||
|
secret="########" # secret for godaddy developer API |
||||||
|
|
||||||
|
headers="Authorization: sso-key $key:$secret" |
||||||
|
|
||||||
|
# echo $headers |
||||||
|
|
||||||
|
result=$(curl -s -X GET -H "$headers" "https://api.godaddy.com/v1/domains/$domain/records/A/$name") |
||||||
|
|
||||||
|
#echo "Current record: $result" |
||||||
|
|
||||||
|
dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") |
||||||
|
echo "dnsIp:" $dnsIp |
||||||
|
|
||||||
|
# Get public ip address there are several websites that can do this. |
||||||
|
ret=$(curl -s GET "http://ipinfo.io/json") |
||||||
|
currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") |
||||||
|
echo "currentIp:" $currentIp |
||||||
|
|
||||||
|
if [ $dnsIp != $currentIp ]; |
||||||
|
then |
||||||
|
echo "Ips are not equal" |
||||||
|
request='{"data":"'$currentIp'","ttl":1800}' |
||||||
|
echo $request |
||||||
|
nresult=$(curl -i -s -X PUT \ |
||||||
|
-H "$headers" \ |
||||||
|
-H "Content-Type: application/json" \ |
||||||
|
-d $request "https://api.godaddy.com/v1/domains/$domain/records/A/$name") |
||||||
|
# echo $nresult |
||||||
|
fi |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/bash |
||||||
|
|
||||||
|
#Directory on the server to backup to |
||||||
|
BACKUPDIR='/mnt/TimeMachine/Backup-JH/backups/' |
||||||
|
LATEST=$(ssh officeServerJH find ${BACKUPDIR} -type d -depth 1 | sort | tail -n 1) |
||||||
|
TODAY=$(date -I -d "today") |
||||||
|
echo ${LATEST##*\/} |
||||||
|
echo ${TODAY} |
||||||
|
|
||||||
|
#This can be tricked by having a folder with a date after the current date |
||||||
|
if [[ ${LATEST##*\/} = ${TODAY} ]]; then |
||||||
|
echo "There already seems to have been a backup today" |
||||||
|
echo "If you want to rename the folder ${LATEST} then run again" |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
#Backup sites directory |
||||||
|
rsync --archive --one-file-system --hard-links --human-readable --inplace\ |
||||||
|
--exclude-from=./backupExcludes\ |
||||||
|
--link-dest=${LATEST}\ |
||||||
|
~/Sites officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose |
||||||
|
|
||||||
|
#Backup Documents Directory |
||||||
|
rsync --archive --one-file-system --hard-links --human-readable --inplace\ |
||||||
|
--exclude-from=./backupExcludes\ |
||||||
|
--link-dest=${LATEST}\ |
||||||
|
~/Documents officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose |
||||||
|
|
||||||
|
#At some point, add ability to delete old backups |
@ -0,0 +1,2 @@ |
|||||||
|
.git/ |
||||||
|
node_modules/ |
@ -0,0 +1,30 @@ |
|||||||
|
#!/usr/bin/bash |
||||||
|
|
||||||
|
# What should the initial commit be for a repo? |
||||||
|
# |
||||||
|
# Idea came after reading this blog post: https://blog.no-panic.at/2014/10/20/funny-initial-git-commit-messages/ |
||||||
|
|
||||||
|
commits=( |
||||||
|
"This is where it all begins..." |
||||||
|
"Commit committed" |
||||||
|
"Version control is awful" |
||||||
|
"COMMIT ALL THE FILES!" |
||||||
|
"The same thing we do every night, Pinky - try to take over the world!" |
||||||
|
"Lock S-foils in attack position" |
||||||
|
"This commit is a lie" |
||||||
|
"I'll explain when you're older!" |
||||||
|
"Here be Dragons" |
||||||
|
"Reinventing the wheel. Again." |
||||||
|
"This is not the commit message you are looking for" |
||||||
|
"Batman! (this commit has no parents)" |
||||||
|
"In the beginning, the code was without form and was void()…" |
||||||
|
) |
||||||
|
|
||||||
|
# Seed random generator |
||||||
|
RANDOM=$$$(date +%s) |
||||||
|
|
||||||
|
# Get random expression... |
||||||
|
selectedexpression=${commits[$RANDOM % ${#commits[@]} ]} |
||||||
|
|
||||||
|
# Write to Shell |
||||||
|
git commit --allow-empty -m "$selectedexpression" |
Loading…
Reference in new issue