Skip to content

Instantly share code, notes, and snippets.

View bdha's full-sized avatar
☂️
ಠ_ಠ

Bryan Horstmann-Allen bdha

☂️
ಠ_ಠ
View GitHub Profile
#!/bin/bash -e
REMOTE_POOL=tank2
LOCAL_POOL=tank
TARGET_HOST=foo
LAST_SYNCED=$( ssh $TARGET_HOST zfs list -t snapshot -o name -r $REMOTE_POOL/zones/icg_db/mysql | tail -1 )
echo "r: $LAST_SYNCED"
LAST_SNAPSHOT=$( zfs list -t snapshot -o name -r tank/zones/icg_db/mysql | tail -1 )
#!/bin/bash
if ! [ $3 ] ; then
echo "$0 <SOURCE POOL/DATASET> <TARGET_HOST> <TARGET POOL/DATASET>"
exit 1
fi
SRC=$1
TARGET_HOST=$2
DST=$3
#!/usr/bin/bash
#
# derek@joyent.com
# determines if server has cstates enabled or not
SERVER=`hostname`;
VAR=`/usr/sbin/dtrace -q -n '
fbt:unix:cpupm_next_cstate:entry
# /root/sdc-dsimport openbsd-5.0-gateway.dsmanifest
Importing Dataset defined in 'openbsd-5.0-gateway.dsmanifest'.
Checking dataset file '/var/tmp/openbsd-5.0-gateway.zvol.bz2' sha1.
Copy dataset file to datasets dir, '/usbkey/datasets/openbsd-5.0-gateway.zvol.bz2'.
Registering dataset b5de0960-592f-11e1-8536-a7811176bc79 (sdc:admin:openbsd-5.0-gateway:1.0) with MAPI.
{
"hostname": "test1",
"alias": "test1",
"brand": "ipkg",
"autoboot": "true",
"default_gateway": "10.0.1.1",
"dns_domain": "local",
"dataset_uuid": "templates/oi-151a",
"nics": [
{
[root@00-0c-29-a1-8b-9d ~]# cat /etc/motd
- SmartOS Live Image v0.147+ build: 20120113T013514Z
[root@00-0c-29-a1-8b-9d ~]# uname -a
SunOS 00-0c-29-a1-8b-9d 5.11 joyent_20120113T013514Z i86pc i386 i86pc
[root@00-0c-29-a1-8b-9d ~]# zlogin test1
[Connected to zone 'test1' pts/3]
Last login: Tue Jan 24 04:03:39 on pts/3
OpenIndiana (powered by illumos) SunOS 5.11 oi_151a September 2011
root@test1:~# cat /etc/release
OpenIndiana Development oi_151a X86
#!/bin/bash
if ! [ $3 ] ; then
echo "$0 <SOURCE POOL/DATASET> <TARGET_HOST> <TARGET POOL/DATASET>"
exit 1
fi
SRC=$1
TARGET_HOST=$2
DST=$3
# Grab any zfs data from "zfs get"
#zfs = Mash.new
#popen4("zfs get -p -H all") do |pid, stdin, stdout, stderr|
# stdin.close
# stdout.each do |line|
# next unless (line =~ /^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)$/)
# filesystem = $1
# zfs[filesystem] = Mash.new unless zfs.has_key?(filesystem)
# zfs[filesystem][:values] = Mash.new unless zfs[filesystem].has_key?('values')
# zfs[filesystem][:sources] = Mash.new unless zfs[filesystem].has_key?('sources')
# Determine which init system we're using and load daemontools for it.
init_system = File.readlink("/proc/1/exe")
case init_system
when /upstart/
log "Using upstart"
cookbook_file "/etc/init/svscanboot.conf" do
source "upstart.svc"
owner "root"
group "root"
# This document describes updating the SmartOS boot_archive and /usr volumes.
#
# The boot_archive effectively contains /. If you want to make changes to SMF
# or so forth, you need to update the boot_archive.
#
# If you want to add things to /usr, such as drivers, you will need to update
# usr.lgz. It is compressed, so note the lofiadm -U and -C calls below. Once
# you have updated usr.lgz you will need to copy it back to the mounted
# boot_arhive.
#