its gonna be one of those days...
its gonna be one of those days...
As an employee of Feedster, Inc. It's important, while reading anything that I happen to blog,
that my entries here are solely my own opinion. Nothing that I say here even remotely reflects
anything about my employer. I am an individual, I have a job just as most everyone has a job. You
are reading the depraved ramblings of the individual not the employee. If you
read something that I say here and then go ranting about how Feedster feels regarding a subject
you will only be showing off your own narrow-minded-ignorance. Thanks for understanding.
--> File systems
--> <M> OCFS2 file system support (EXPERIMENTAL)
#!/sbin/runscript
depend() {
need net
after *
}
start() {
ebegin "Loading OCFS2 Modules: configfs: "
modprobe configfs
eend $? "Error Loading Module"
ebegin "Loading OCFS2 Modules: ocfs2_nodemanager: "
modprobe ocfs2_nodemanager
eend $? "Error Loading Module"
ebegin "Loading OCFS2 Modules: ocfs2_dlm: "
modprobe ocfs2_dlm
eend $? "Error Loading Module"
ebegin "Loading OCFS2 Modules: ocfs2_dlmfs: "
modprobe ocfs2_dlmfs
eend $? "Error Loading Module"
ebegin "Loading OCFS2 Modules: ocfs2: "
modprobe ocfs2
eend $? "Error Loading Module"
ebegin "Mounting OCFS2 Special Filesystem: /dlm: "
mkdir -p /dlm
mount -t ocfs2_dlmfs ocfs2_dlmfs /dlm
eend $? "Error Mounting Filesystem"
ebegin "Mounting OCFS2 Special Filesystem: /config: "
mkdir -p /config
mount -t configfs configfs /config
eend $? "Error Mounting Filesystem"
ebegin "Starting OCFS2 Cluster Service: "
##
## Edit here (-n "ocfs2") to change the cluster name
##
o2cb_ctl -H -n "ocfs2" -t cluster -a online=yes
eend $? "Error Starting Service"
ebegin "Mounting ocfs2: "
##
## Edit here.. This is all pretty normal stuff
##
mkdir -p /mnt/ocfs2/
mount /dev/sda1 /mnt/ocfs2/ -t ocfs2
eend $? "Error mounting ocfs2"
}
stop() {
ebegin "Unmounting ocfs2"
##
## Edit here.. This is all pretty normal stuff
##
umount /mnt/ocfs2
sleep 2
eend $? "Error Unmounting ocfs2"
ebegin "Stopping OCFS2 Cluster Service:"
##
## Edit here (-n "ocfs2") to change the cluster name
##
o2cb_ctl -H -n "ocfs2" -t cluster -a online=no
sleep 2
eend $? "Error Stopping Service"
ebegin "Unmounting OCFS2 Special Filesystem: /dlm: "
umount /dlm
eend $? "Error Mounting Filesystem"
ebegin "Mounting OCFS2 Special Filesystem: /config: "
umount /config
eend $? "Error Mounting Filesystem"
}
restart() {
svc_stop
svc_start
}
inherit flag-o-matic eutils
DESCRIPTION="[C] Support programs for the Oracle Cluster Filesystem v2"
HOMEPAGE="http://oss.oracle.com/projects/ocfs2-tools/"
SRC_URI="http://oss.oracle.com/projects/ocfs2-tools/dist/files/source/v1.1/${P}.tar.gz"
RESTRICT="nomirror"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-* x86 amd64"
IUSE=""
DEPEND=""
RDEPEND=""
src_unpack() {
unpack ${P}.tar.gz
cd ${S}
}
src_compile() {
local myconf=""
econf --prefix=/ --enable-ocfs2console=no --enable-dynamic-fsck=yes --enable-dynamic-ctl=yes ${myconf} || die "Failed to configure"
emake -j1 || die "Failed to compile"
}
src_install() {
make DESTDIR=${D} install || die "Failed to install"
exeinto /etc/init.d
newexe ${FILESDIR}/rc.ocfs2 ocfs2
}
serverx ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 226G 176G 39G 83% /
none 2.0G 0 2.0G 0% /dev/shm
serverx ~ $ du -hs /opt/builds/
4.1T /opt/builds/
#!/bin/bash
###
### Simple bash script locking illustration
###
### By: Demitrious S. Kelly
###
### FWIW: YMMV: Use at your own risk
###
LOCKFILE=/var/lib/locks/this_job.lock
LOCKEXPIRE=600
NOW=$(date +%s)
CONT=1
if [ -f $LOCKFILE ]
then
echo -e $(date)"\tLock Found"
CONT=0
LOCKTIME=$(cat $LOCKFILE)
let LOCKELAPSED=$NOW-$LOCKTIME
if [ $LOCKELAPSED -gt $LOCKEXPIRE ]
then
CONT=1
echo -e $(date)"\tLock Expired ($LOCKELAPSED), Contnuing"
else
echo -e $(date)"\tLock Not Yet Expired ($LOCKELAPSED), Aborting"
fi
else
echo -e $(date)"\tLock Not Found"
fi
if [ $CONT -eq 0 ]
then
exit 1
fi
echo -e $(date)"\tCreating Lockfile"
echo $NOW > $LOCKFILE
###
### Job goes below here, inside the lockfile wrapper
###
echo $(date +%s) > $LOCKFILE
## do stuff
## ...
echo $(date +%s) > $LOCKFILE
## do stuff
## ...
echo $(date +%s) > $LOCKFILE
## do stuff
## ...
###
### Job goes above here, inside the lockfile wrapper
###
echo -e $(date)"\tRemoving Lockfile\r\n\r\n"
rm $LOCKFILE