This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# carbon-cache | |
# | |
# Graphite's carbon-cache daemon init script. | |
# | |
# William Kettler <william.p.kettler@gmail.com> | |
# | |
# Source init-functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################################### | |
# Last tested & updated 04/09/2014 | |
#################################### | |
VERS="0.9.12" | |
# Make sure only root can run script | |
if [[ $EUID -ne 0 ]] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# zstatus.sh | |
# | |
# Check pool status. | |
# | |
EMAIL="test@somewhere.com" | |
HOSTNAME="$(hostname)" | |
# Linux | |
STATUS="$(/sbin/zpool status -x)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# makemkv.sh | |
# | |
# Rip a DVD/BLURAY using MakeMKV. | |
# | |
DIR="/srv/media/dvdimport/backup/" | |
LOG="/tmp/makemkv.log" | |
DRV=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prompt_yn(question): | |
""" | |
Prompt the user with a yes or no question. | |
Input: | |
question (str): Question string | |
Output: | |
answer (bool): Answer True/False | |
""" | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import signal | |
class Signal(Exception): | |
""" | |
This exception is raise by the signal handler. | |
""" | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def to_bytes(value): | |
""" | |
Convert a size string with an exponent into bytes. | |
Input: | |
value (str): Size string | |
Output: | |
bytes (int): Size in bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def to_units(value, unit): | |
""" | |
Convert a size string from unit x to unit y. | |
Input: | |
value (str): Size string | |
unit (str): Unit to convert to | |
Output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prompt(question, answers): | |
""" | |
Prompt the user with a question and only accept defined answers. | |
Input: | |
question (str): Question string | |
answers (list): A list containing accpeted response value | |
Output: | |
answer (str|int): Provided answer | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from execute import execute, Retcode | |
import re | |
def get_zpool_drives(zpool): | |
""" | |
Returns all drives in the zpool. | |
Inputs: | |
zpool (str): Zpool name | |
Outputs: |
OlderNewer