Skip to content

Instantly share code, notes, and snippets.

@nde1
nde1 / add-flow-to-vm.sh
Created November 22, 2022 19:21 — forked from Multikas/add-flow-to-vm.sh
Script for limiting SmartOS zones bandwidth.
#!/usr/bin/bash
#
# Script should be run in GZ.
#
# example:
# ./add-flow-to-vm.sh c480b89f-f8a1-41b1-abd0-45bac4685cb2 15M
#
# It will add TCP/UDP flows for this particular VM, and limits bandwidth to 15Mbps
#
@nde1
nde1 / erlang-on-smartos.sh
Created January 9, 2021 02:08
erlang r15b02 + openssl 1.0.1c + zlib on smartos
#!/bin/sh
set -e
if [ "$1" = "-d" ] || [ "$1" = "--debug" ]; then
DEBUG=1
fi
[ "$DEBUG" = "1" ] && set -x
smarthost=mail.sample.com
user=me
alertlist=alert@mail.sample.com
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/submit.cf
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/sendmail.cf
/opt/csw/bin/gsed -i "/$user:/d" /etc/mail/aliases
echo "$user:$alertlist" >> /etc/mail/aliases
/opt/csw/bin/gsed -i "/root:/d" /etc/mail/aliases
echo "root:$alertlist" >> /etc/mail/aliases
newaliases
@nde1
nde1 / zfs_health.sh
Created September 23, 2020 03:43 — forked from petervanderdoes/zfs_health.sh
ZFS Health Check Script
#! /usr/local/bin/bash
#
# Calomel.org
# https://calomel.org/zfs_health_check_script.html
# FreeBSD 9.1 ZFS Health Check script
# zfs_health.sh @ Version 0.15
# Check health of ZFS volumes and drives. On any faults send email. In FreeBSD
# 10 there is supposed to be a ZFSd daemon to monitor the health of the ZFS
# pools. For now, in FreeBSD 9, we will make our own checks and run this script
@nde1
nde1 / gist:565854c5d317e6cc571362a226fe8526
Created April 19, 2020 01:39 — forked from mattconnolly/gist:6127693
Using zonecfg to fix missing DNS resolvers in a SmartOS zone.
# zonecfg -z <uuid>
zonecfg:uuid> add attr
zonecfg:uuid:attr> set name=resolvers
zonecfg:uuid:attr> set type=string
zonecfg:uuid:attr> set value=8.8.8.8,8.8.4.4
zonecfg:uuid:attr> end
zonecfg:uuid> verify
zonecfg:uuid> commit
zonecfg:uuid> exit
# vmadm reboot <uuid>