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 | |
# | |
# This script is inteded to be used as resource script by heartbeat | |
# | |
# Copright 2003-2008 LINBIT Information Technologies | |
# Philipp Reisner, Lars Ellenberg | |
# | |
### | |
DEFAULTFILE="/etc/default/drbd" |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use CGI; | |
use CGI::Carp qw(fatalsToBrowser); | |
use JSON; | |
my $q = CGI->new(); | |
my $json = $q->param('json'); |
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
# Logging | |
if [ $UID -ne 0 ]; then | |
logdir_base="/var/log/user/$USER" | |
if [ -d $logdir_base ]; then | |
YYMM=$(date +%Y%m) | |
LOGDIR=$logdir_base/$YYMM | |
if [ ! -d $LOGDIR ]; then | |
mkdir -p $LOGDIR | |
fi |
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
# df -PT /mnt/vol1 | |
Filesystem Type 1024-blocks Used Available Capacity Mounted on | |
sv01:/vol1 fuse.glusterfs 368136192 41472640 307963264 12% /mnt/vol1 | |
# cd /mnt/vol1 | |
# mkdir {0..9} | |
# dir=$(ls) | |
# for d in $dir; do dd if=/dev/zero of=./$d/hoge.dat bs=1M count=100; done | |
# strace ls * | |
execve("/bin/ls", ["ls", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], [/* 22 vars */]) = 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
use Sys::Guestfs; | |
my $h = Sys::Guestfs->new(); | |
$h->add_drive_opts( | |
'disk.img', | |
readonly => 1, | |
format => 'qcow2', | |
); | |
$h->launch(); |
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
use strict; | |
use warnings; | |
use Sys::Virt; | |
use XML::Simple; | |
use Data::Dump qw(dump); | |
my $user = 'user'; | |
my $host = 'host'; | |
my $vm = shift or die; | |
my $uri = "qemu+ssh://$user\@$host/system"; | |
my $vmm = Sys::Virt->new(uri => $uri); |
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
## $ ls | |
## hoge | |
## $ bu hoge | |
## $ ls | |
## hoge hoge_yyyymmdd | |
bu (){ | |
if [ $# -ne 1 ]; then | |
echo "bu: missing file operand" |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
## one liner | |
# perl -ne 'print unpack("H*", $_)' < ascii > binary | |
# perl -ne 'print pack("H*", $_)' < binary > ascii | |
my $mode = shift || help(); |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Sys::Virt; | |
use Data::Dump qw(dump); | |
my $user = "user"; | |
my $host = "host"; |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $busybox = './busybox'; | |
my $help = qx{$busybox --help 2>&1}; | |
my ($data) = $help =~ m/Currently \s defined \s functions: (.*)/msx; | |
$data =~ s/\s+//g; |