Skip to content

Instantly share code, notes, and snippets.

@Hemanthdev
Hemanthdev / kobo-docker_to_digital_ocean_spaces.sh
Created April 29, 2022 18:07 — forked from ivangayton/kobo-docker_to_digital_ocean_spaces.sh
Transferring files from a Kobo-Docker instance to Ditigal Ocean Spaces (should be same for AWS)
#!/bin/bash
# From a cloud instance of Kobo-Docker, pull all of the attachments
# and place them in a (much cheaper) Spaces filebin.
# Assumes a Kobo-Docker instance running on a DO Ubuntu 16.04 instance
# Need Amazon's CLI utility to manage transfers to/from spaces
sudo apt install s3cmd
@Hemanthdev
Hemanthdev / create-queue.sh
Created April 22, 2022 10:58 — forked from mjgp2/create-queue.sh
Instantly mirror an S3 bucket to a local directory, e.g. for ELB logs to be consumed by logstash
region=us-east-1
s3_bucket_name=$1
sns_topic_name=$2
sqs_queue_name=$sns_topic_name
# create the SNS topic
sns_topic_arn=$(aws sns create-topic \
--region "$region" \
--name "$sns_topic_name" \
--output text \
@Hemanthdev
Hemanthdev / subscription_by_queue_arn.sh
Created April 22, 2022 10:58 — forked from jbrechtel/subscription_by_queue_arn.sh
goaws SNS -> SQS subscription
#!/bin/sh
echo "CREATING SUBSCRIPTION WITH QUEUE ARN"
set -e
ENDPOINT_URL="http://localhost:4100"
export AWS_DEFAULT_REGION="us-east-1"
export AWS_SECRET_ACCESS_KEY="fakefakefake"
export AWS_ACCESS_KEY_ID="faketyfakefake"
TOPIC_ARN=$(aws --endpoint-url $ENDPOINT_URL sns create-topic --name test-topic | jq -r ".TopicArn")
@Hemanthdev
Hemanthdev / aws_backup_notifications.sh
Created April 22, 2022 10:58 — forked from sandjaie/aws_backup_notifications.sh
Enable Notifications for AWS Backup Vaults
#!/bin/bash
REGION="eu-central-1"
BACKEND_URL="https://backup.${REGION}.amazonaws.com"
#get curent account id
ACCOUNT="$(aws sts get-caller-identity --query 'Account')"
ACCOUNT_ID="$(echo ${ACCOUNT} | sed 's/"//g')"
echo "Current Account ID: ${ACCOUNT_ID}"
#!/bin/bash
# Forward Notification to AWS SNS
if [ "$NOTIFY_WHAT" = HOST ]
then
aws sns publish --topic-arn arn:aws:sns:eu-central-1:123123123123:Alerts --message "$NOTIFY_HOSTNAME $NOTIFY_HOSTOUTPUT "
else
aws sns publish --topic-arn arn:aws:sns:eu-central-1:123123123123:Alerts --message "$NOTIFY_HOSTNAME $NOTIFY_SERVICEDESC $NOTIFY_SERVICEOUTPUT "
fi
#
@Hemanthdev
Hemanthdev / knife_base.bash
Created April 22, 2022 10:58 — forked from bageljp/knife_base.bash
knife command parallel exec in hosts
#!/bin/bash
SH_KNIFE="/usr/local/chef/chef-repo/knife_parallel.bash"
LOG_FILE="/usr/local/chef/chef-repo/knife_base.log"
func_usage() {
echo "Usage: `basename $0` {bootstrap|prepare|cook}"
return 0
}
@Hemanthdev
Hemanthdev / apache_check_restart.sh
Created April 22, 2022 10:58 — forked from MattHealy/apache_check_restart.sh
Check if Apache is running, and if not, restart it
#!/bin/sh
PORT=80
HP=:$PORT
echo 'Checking to see if Apache is up...'
if ( /usr/sbin/lsof -Pni $HP | grep "$PORT (LISTEN)" 2>&1 >/dev/null ); then
echo 'Apache is up';
else
echo 'Apache is down, restarting...';
/sbin/service httpd restart
logger -p mail.info apache_check_restart.sh restarting Apache
@Hemanthdev
Hemanthdev / Mongo-node-install.sh
Last active May 13, 2020 17:17
Mongo-node-install
#!/bin/bash
# Currently Supported Operating Systems:
#
# RHEL 5, 6, 7
# CentOS 5, 6, 7
# Debian 7, 8
# Ubuntu 12.04 - 18.04
# SUSE 12- 15
#
@Hemanthdev
Hemanthdev / deploy.sh
Created May 4, 2020 12:36 — forked from jjpeleato/deploy.sh
Shell script for remote deployment. (Script run on Ubuntu 18.04)
#!/bin/bash
#
# Shell script for remote deployment.
#
# Notes:
# - Git is assumed
# - Composer is assumed
# - NPM is assumed
# - Windows host and Cygwin environment is assumed
#!/usr/bin/env bash
#https://www.shellscript.sh/functions.html
install_gist() {
echo "
______________________________________________________________________________________
install bash framework
______________________________________________________________________________________