Skip to content

Instantly share code, notes, and snippets.

@bahamat
bahamat / triton-update-all
Last active January 31, 2021 16:52
Script to update/upgrade all components of SDC/Triton
[root@headnode (barovia) ~]# cat /opt/custom/bin/update-all
#!/bin/bash
set -o errexit
set -o xtrace
imgadm vacuum -f
sdcadm update --all --just-images -y
sdcadm self-update --allow-major-update --latest
@bahamat
bahamat / shell_config.md
Last active March 15, 2023 02:42
How are various shells configured, and in which order?

ash & dash

login interactive files
N N
N Y $ENV
Y N /etc/profile, ~/.profile
Y Y /etc/profile, ~/.profile, $ENV

bash

@bahamat
bahamat / cmon.sh
Last active April 25, 2024 18:43
Shell script to pull CMON metrics from Joyent Triton (https://www.joyent.com/triton)
#!/bin/bash
# shellcheck disable=SC2154
if [[ -n "$TRACE" ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
fi
export PATH=/opt/pkg/bin:/opt/local/bin:/opt/custom/bin:$PATH
@bahamat
bahamat / pkgsrc-brew.md
Created May 22, 2017 23:45
Packages I get from brew instead of pkgsrc, and why
pkg why
dnstracer not available
fortune not available
ghc not available on mac
hping out of date (pkgsrc==hping2, brew==hping3)
nagios-plugins does not compile on mac. Maybe brew patch(es) can be used?
shunit2 not available
tcpflow out of date (pkgrsc==0.21, brew==1.4); depends on dfxml which does not compile on smartos due to missing MAP_FILE ([tcpflow#91)[simsong/tcpflow#91])
@bahamat
bahamat / pipasswd
Last active July 29, 2020 15:29
pipasswd - Get the default root password for platform images installed in Triton
#!/bin/bash
set -o errexit
set -o pipefail
if [[ -n "$TRACE" ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
fi
@bahamat
bahamat / flask_example.md
Created July 25, 2017 05:09
Simple flask example.
@bahamat
bahamat / auto_homedir
Created November 17, 2018 19:51
auto_homedir for use with illumos autofs to create user home directories on first access
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2018 Brian Bennett <brian.bennett@joyent.com>
# Inspired by
# http://znogger.blogspot.com/2010/05/solaris-automatic-creation-of-home-dirs.html
NAME STATE READ WRITE CKSUM
zones ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c10t01d0 ONLINE 0 0 0
c11t01d0 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t05d0 ONLINE 0 0 0
c2t0Dd0 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
c3t09d0 ONLINE 0 0 0
@bahamat
bahamat / triton-grafana.json
Created July 16, 2019 19:44
Grafana dashboard template for Triton
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@bahamat
bahamat / dnsupdate.py
Created July 27, 2019 09:09 — forked from pklaus/dnsupdate.py
dnsupdate is meant to replace nsupdate, the standard DDNS update tool created by BIND authors ISC. While nsupdate does the job it is awkward to wrap in scripts and its usage in general is just not very intuitive. dnsupdate is meant to work well from the command line or from scripts and easy to use. It also does some nice things like automaticall…
#!/usr/bin/env python2.7
# Matt's DNS management tool
# Manage DNS using DDNS features
#
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/
#
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com.
# -h HELP!
# -s the server
# -k the key