Skip to content

Instantly share code, notes, and snippets.

View marinnedea's full-sized avatar
:atom:
3rd rock from the Sun, Sol system

Marin N. marinnedea

:atom:
3rd rock from the Sun, Sol system
View GitHub Profile
@marinnedea
marinnedea / clean_waagent_pid_files.sh
Last active May 8, 2018 10:58
Clear orphaned waagent PID files - Azure WaAgent on Linux related
#!/bin/bash
#get the running waagent PID
waagentpid=$(ps axf | grep waagent | grep -v grep | awk '{print $1}')
#all waagent.pid files in /var/run/ directory
dir=/var/run/*waagent.pid
#for each file in $dir
for f in $dir
@marinnedea
marinnedea / aptkill.sh
Last active May 7, 2018 13:44
Kill apt and make sure there's no dpkg lock in place.
# !/usr/bin/env bash
# Setting the logfile location
logfile=/var/log/kill_output.log
# Logging all actions
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$logfile 2>&1
@marinnedea
marinnedea / linux_coomand_invoke_sample_script.sh
Last active May 8, 2018 10:43
Interactiv Deployment Linux VM script that, post deployment, will run a custom script from your local Linux box on the newly deployed VM.
#!/usr/bin/env bash
# This script is provided as it is and
# there's no guarantee that this will
# work for you.
# Please adapt it to your needs!
# Get the variables
read -p 'Resource Group: ' my_resource_group
read -p 'VM Name:' vmname
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2015 Microsoft Azure
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/bin/bash
#################################################################################
# Script to partition automatically new disks added to a linux machine. #
# The script will create a single partition on the whole free space of the disk #
#################################################################################
# Setting the logfile location
logfile=/var/log/disk_part.log
# !/usr/bin/env bash
# Setting the logfile location
logfile=/var/log/mount_disks.log
# Logging all actions
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$logfile 2>&1
# !/usr/bin/env bash
# Setting the logfile location
logfile=/var/log/mount_enc_disk.log
# Logging all actions
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$logfile 2>&1
#!/usr/bin/env bash
# THIS IS A SAMPLE FILE!
# USE ACTUAL DATA WHEN DEPLOYING IT!
# AzCli 2.0 command:
# az vmss extension set \
# --publisher Microsoft.Azure.Extensions \
# --version 2.0 \
# --name CustomScript \
# --resource-group myResourceGroup \
# --vmss-name myScaleSet \
#!/bin/bash
####### Check if root is running this script, and bail if not root
# be root or exit
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
#!/bin/bash
#########################################################################################################
# Title: Find Windows Azure Agent version on all VMs in all subscriptions #
# Author: Marin Nedea #
# Created: June 24th, 2020 #
# Usage: Just run the script with sh (e.g. sh script.sh) #
# Requires: AzCli 2.0 installed on the machine you're running this script on #
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest #
# If enabled, you can run it through the bash Cloud Shell in your Azure Portal page. #