INIT Script for Samba


#!/bin/sh

PATH=”/usr/local/samba/bin”
exec 2>&1
exec smbd -F -S -d3

Advertisements

INIT Script for DropBox


#!/bin/bash

DROPBOX_USERS=”angus”
DROPBOX_CLIENT=”/usr/local/bin/dropbox.py”

RETVAL=0

dropbox() {
for dbuser in $DROPBOX_USERS; do
if [[ “$USER” -eq “$dbuser” ]]; then
“$DROPBOX_CLIENT” “$1”
else
su $dbuser -c “$DROPBOX_CLIENT $1”
fi
done
}

case “$1″ in
start)
dropbox start
;;
stop)
dropbox stop
;;
restart)
dropbox stop
dropbox start
;;
status)
dropbox status
;;
*)
echo $”Usage: $prog {start|stop|restart|status}”
RETVAL=3
esac
exit $RETVAL

INIT Script for DUDE


#!/bin/bash

action=${1}

. /etc/rc.d/init.d/functions

User Options
xvfb_pidfile=’/var/run/dude-xvfb.pid’
wine_pidfile=’/var/run/dude-wine.pid’
virtual_display=’:1′

export DISPLAY=$virtual_display
export WINEPREFIX=’/srv/wine’

start ()
{
echo -n ‘Starting Dude virtual display:’
Xvfb $virtual_display &> /dev/null &
echo $! > $xvfb_pidfile
success
echo
echo -n ‘Starting Dude Server:’
sleep 5
wine ‘c:\program files\dude\dude.exe’ –server &> /dev/null &
echo $! > $wine_pidfile
success
touch /var/lock/subsys/dude
echo
}

stop ()
{
echo -n ‘Stopping Dude Server:’
kill $(cat $wine_pidfile)
rm -f $wine_pidfile
sleep 5
success
echo
echo -n ‘Stopping Dude virtual display:’
kill $(cat $xvfb_pidfile)
rm -f $xvfb_pidfile
success
rm -f /var/lock/subsys/dude
echo
}

case “$action” in
start)
start
;;

stop)
stop
;;

*)
echo “Usage: $0 {start|stop}”
;;
esac

Init Script for FreeNAS


#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions
. /lib/init/vars.sh

[ -f /etc/default/zfs ] && . /etc/default/zfs

do_start() {
log_begin_msg “Starting ZFS subsystem”
log_progress_msg “filesystems”
zfs mount -a
RET=$?
if [ $RET != 0 ] ; then
log_end_msg $RET
exit $RET
fi
log_end_msg 0

log_begin_msg “Exporting ZFS filesystems”
zfs share -a
log_end_msg $?
}

do_stop() {
log_begin_msg “Stopping ZFS subsystem”
log_progress_msg “filesystems”
zfs umount -a
RET=$?
if [ $RET != 0 ] ; then
log_end_msg $RET
fi
log_end_msg 0
}

do_status() {
zpool status
echo ”
zpool list
true
}

case “$1” in
start)
[ -z “$ZFS_MOUNT” ] && exit 0
do_start
;;
stop)
[ -z “$ZFS_UNMOUNT” ] && exit 0
do_stop
;;
status)
do_status
;;
*)
[ -n “$1” ] && echo “Error: Unknown command $1.”
echo “Usage: $0 {start|stop|status}”
exit 3
;;
esac

chmod 755 /etc/init.d/zfs

Camera Import Script for Linux


#!/bin/bash

Variables & Paths
PhotosPath=”/media/4GBSD/DCIM/NIKON”
SortPath=”/home/chaitu/.imagesort”
LibraryPath=”/home/chaitu/Photos”
CameraPath=”/media/4GBSD”
jheadPath=”/usr/bin/jhead”
CharFromName=4
echo
echo

Test to See if $PhotosPath Exists
test -d $PhotosPath || read -p “$PhotosPath does not exist, close to exit or type new path:” PhotosPath
test -d $PhotosPath || “read -p ‘$PhotosPath is invalid. Press enter to close’ && exit”

Test to see if jhead exists
test -x $jheadPath || “read -p ‘$jheadPath is not availible. Press enter to close’ && exit”

Move Files from Camera to $SortPath
mv $PhotosPath/* $SortPath/

Moving all avi\’s into $LibraryPath/Movies/
find $SortPath -iname ‘*.avi’ -exec ‘mv’ $LibraryPath/Movies \;

Renaming all images to FolderDateDD-HHMMSS.ext
jhead  -autorot -ft -nf%y%m%d-%H%M%S $SortPath/*

Sorting files into correct folders
ls $SortPath | while read file; do

Extract first $CharFromName characters from filename
FolderDate=${file:0:$CharFromName}

Create Directory if it does not exist
test -d $LibraryPath/$FolderDate || mkdir $LibraryPath/$FolderDate

Move the current file to the destination dir
mv -v $SortPath/$file $LibraryPath/$FolderDate/$file
done

Unmounting SD card
umount $CameraPath

End notification
echo
echo
echo “Photos  from: $PhotosPath”
echo “End location: $LibraryPath”
echo
echo “The card has been ejected.”
echo
read -p “Press enter to start F-Spot importing⦔

Start f-spot import
nohup f-spot –import $LibraryPath &
echo
read -p “Press enter when finished.”