Backup2Novell (v2.0)

Summary: Backup2Novell automates the process of archiving a folder or file, and then adding it to a specific folder on a Novell server. It uses 7zip for Unix for it’s archives.

Requirements:

  • ncpfs
  • p7zip

Code:

#!/bin/bash

##By Blake Johnson

USERNAME="USERNAME" ##Novell Username (this is case sensative to whatever the mounted directory will use.)
CONTEXT="something.something" ##Novell Context w/ out beginning dot.
PASSWORD="PASSWORD" ##Novell Password

BACKUPNAME="public_html" ##This must not contain any special characters.
BACKUPSOURCE="${HOME}/public_html/" ##What file or folder would you like to back up?

SERVERNAME="SERVERNAME" ##The name of the remote Novell server.
SERVERADDRESS="SERVERIP" ##The address of the remote Novell server.

MOUNTDIRECTORY="${HOME}/mnt/MOUNTPOINT" ##The directory where you want to mount the Novell share.

BACKUPHOME="${MOUNTDIRECTORY}/STAFF/USERS/Folders/${USERNAME}" ##Directory where you are first able to write.
BACKUPFILENAME="${BACKUPNAME}.`date +%Y%m%d`.7z" ##This must not contain any special characters.
BACKUPDESTINATION="${MOUNTDIRECTORY}/Folders/${USERNAME}/.backup/${BACKUPNAME}" ##Where should the backup file be placed?

##Write Date & Time to Log File
echo "-------------------------------------" > ~/.Backup2Novell.log
echo "`date +%B %d, %Y`" >> ~/.Backup2Novell.log
echo "-------------------------------------" >> ~/.Backup2Novell.log

echo -n "Checking if the ncpfs package is installed... "
if [ -x /usr/bin/ncpmount ] ; then
	echo -e "33[1;32mOK!"
	echo -e "33[0m"

	##Log in to Novell Share and mount it.
	echo -n "Mounting Novell Share... "
	echo "ncpmount -S ${SERVERNAME} -A ${SERVERADDRESS} -U ${USERNAME}.${CONTEXT} -P ${PASSWORD} ${MOUNTDIRECTORY}" >> ${HOME}/.Backup2Novell.log
	ncpmount -S ${SERVERNAME} -A ${SERVERADDRESS} -U ${USERNAME}.${CONTEXT} -P ${PASSWORD} ${MOUNTDIRECTORY} >> ${HOME}/.Backup2Novell.log

	##Check to see if userfolder exists.
	if [ -d ${BACKUPHOME} ] ; then

		echo -e "33[1;32mOK!"
		echo -e "33[0m"
		echo "Backing up ${BACKUPSOURCE}"
		echo "Please Wait..."

		##Compress and archive backup source and send it to the Novell Folder.
		echo "7z a "${BACKUPDESTINATION}/${BACKUPFILENAME}" "${BACKUPSOURCE}" >> ${HOME}/.Backup2Novell.log" >>  ${HOME}/.Backup2Novell.log
		7z a "${BACKUPDESTINATION}/${BACKUPFILENAME}" "${BACKUPSOURCE}" >> ${HOME}/.Backup2Novell.log

		##Check to see if the file was written.
		if [ -e "${BACKUPDESTINATION}/${BACKUPFILENAME}" ] ; then
			echo -e "~/public_html Backup 33[1;32mSuccessful"
			echo -e "33[0m"
		else
			echo -e "~/public_html Backup 33[1;31mFailed"
			echo -e "33[0mUnable to write to destination"
		fi

		##Unmount and log out of the Novell share.
		echo -n "Unmounting Novell Share... "
		echo "ncpumount ${MOUNTDIRECTORY}" >> ${HOME}/.Backup2Novell.log
		ncpumount ${MOUNTDIRECTORY} >> ${HOME}/.Backup2Novell.log

		if [ -d ${BACKUPHOME} ] ; then
			echo -e "33[1;31mFailed!"
			echo -e "33[0m"
		else
			echo -e "33[1;32mOK!"
			echo -e "33[0m"
		fi

	else
		echo -e "33[1;31mFailed!"
		echo -e "33[0m"
	fi

else
	echo -e "33[1;31mFailed."
	echo -e "33[0mYou must install the ncpfs package in order for this script to work."
	echo
fi

echo "This script will self-destruct in 5 seconds."
sleep 5s

WavPack Frontend (v0.8)

Summary: Tired of using the command line switches to convert a song to the Wavpack format? This will make your life a bit easier.

Requirements:

Code:

@echo off

::
::Set wavpackexe to the path of the WavPack exe on your system.
::

set wavpackexe="C:Program FilesWavPackwavpack.exe"

::
::Other Variables
::

set target= 


echo -------------------------
echo   WavPack Frontend v0.8
echo -------------------------
echo     By Blake Johnson

if exist %2 goto alert2files
if exist %1 goto pass2
goto pass1


:pass1
echo.
echo.
echo First of all, where is your file located?
echo (Feel free to drag and drop it in this box.)
echo.
Set /p source=Location of file:
cls
goto menu


:alert2files
echo.
echo.
echo You have selected more than one file, only one file will be used.
echo File being used: %1
goto pass2


:pass2
echo.
echo.
set source=%1
goto menu


:menu
echo.
echo.
echo Here are some more options.
echo.
echo 1. Choose other destination.
echo 2. Tag the file.
echo 3. Convert to WavPack.
echo.
echo 4. Exit.

set /p option=What option do you want? 

cls

if "%option%"=="1" goto cngtarget
if "%option%"=="2" goto tag
if "%option%"=="3" goto convert2wv
if "%option%"=="4" goto exit

cls
echo %option%
echo.
echo. You did not choose a valid option.
echo. Please try again.
goto menu


:cngtarget
echo.
echo.
echo Choose a new destination. (Physical path to file only.)
echo USE QUOTES!!!
echo.
echo To cancel, just press enter.
echo.
echo.
set /p target=Destination:
cls
goto menu


:tag
echo.
echo.
echo Enter the following information for tagging.
echo If you leave one blank, it will not exist as a tag.
echo.
set /p artist=Artist:
set /p title=Title:
set /p album=Album:
set /p year=Year:
set /p track=Track #:
set /p genre=Genre:
echo.
echo.
echo If the following is not correct, exit the batch file and try again.
echo.
if not "%artist%"=="" echo Artist: %artist%
if not "%title%"=="" echo Title: %title%
if not "%album%"=="" echo Album: %album%
if not "%year%"=="" echo Year: %year%
if not "%track%"=="" echo Track: %track%
if not "%genre%"=="" echo Genre: %genre%
echo.
echo.
pause
cls
goto menu

:convert2wv
echo.
echo.
%wavpackexe% -w "Artist=%artist%" -w "Title=%title%" -w "Album=%album%" -w "Year=%year%" -w "Track=%track%" -w "Genre=%genre%" -h %source% %target%


:exit
exit

The Process Killer (v0.7)

Summary: Have a process that won’t die? Maybe this will help remedy the situation. It does not always works, but it’s worth a shot if the Windows Task Manager fails to deliver.

Requirements:

  • Windows XP Professional

Code:

@echo off
echo ---------------------------
echo  The Process Killer v0.7
echo ---------------------------
echo      By Blake Johnson
echo.
echo.

:home
echo Type 'v' to view open processes and their PIDs, or type a PID to continue.
echo.
set /p command=Command or PID:
if "%command%"=="v" goto viewpids
if not "%command%"=="v" goto kill

:viewpids
tasklist | more
echo - - - - - -
echo.
goto home

:kill
ntsd -p %command% -c "q"
pause

Image Unloader (v0.1)

Summary: Image Unloader is a simple batch file for unloading images from a UMS digital camera to the “My Pictures” folder. It creates a folder of the current data, and all the images are unloaded in there. After they are copied, the images on the camera are removed.

Requirements:

  • Windows

Code:

@echo off

set cameradir=E:DCIM101MSDCF
set basedestdir=C:Documents and SettingsUSERPROFILEHEREMy DocumentsMy Pictures
set wazdate=%DATE%
set udate=%wazdate:~10,4%-%wazdate:~4,2%-%wazdate:~7,2%

mkdir "%basedestdir%%udate%"

echo Moving images from your camera to your hard drive....

copy /V "%cameradir%*.*" "%basedestdir%%udate%"

del /Q "%cameradir%*.*"

pause

Warning: As of this version, this script could potentially cause image loss if the copy command fails to complete properly. If that happens, there are a few free recovery programs out there that will recover those photos, just as long as they have not been overwritten by something else.

DVDBackupExpress (v0.7)

DVDBackupExpress is a script to automate the process of backing up an entire DVD-Video disc (minus the data content that may be on there). The script will convert the DVD into a *.iso file.

Requirements:

  • dvdbackup
  • Linux
  • libdvdcss
  • mkisofs

Code:

#!/bin/bash
DEVICEPATH="/dev/sr0"
BACKUPPATH="${HOME}/Desktop"
TMP="${TMPDIR}"
LOG="${HOME}/.DVDBackupExpress.log"

##Write Date & Time to Log File
echo "-------------------------------------" > "${LOG}"
echo "`date +%B %d, %Y`" >> "${LOG}"
echo "-------------------------------------" >> "${LOG}"

echo "DVDBackupExpress"
echo "Scripted by Blake Johnson"
echo "http://www.blakeanthonyjohnson.com/"
echo



echo -n "Getting DVD Information... "

label=`dvdbackup -I -i "${DEVICEPATH}" | grep DVD-Video` >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
	label=${label:43}
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "Unable to get DVD information."
	echo "Press any key to exit."
	read
	exit
fi

echo "The title detected was: "${label}""
echo
echo "If you would like to change the title of your DVD image, please do so now.  Otherwise, leave it blank."
echo -n "New Title: "
read title

if [ -z $title  ]
then
	title=${label}
fi

echo
echo "The DVD image will be labeled "${title}.iso" and will be placed in "${BACKUPPATH}/"."
echo
echo "Press any key to continue, or get out and try again."
echo "If you continue, the next two steps may take a while to complete, which is normal."
read
echo
echo -n "Decrypting DVD-Video to "${TMP}/${label}/"... "

dvdbackup -M -v 9 -i "${DEVICEPATH}" -o "${TMP}" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -e -n "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -e -n "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while decrypting."
	echo "Press any key to exit."
	read
	exit
fi

echo -n "Creating DVD image from "${TMP}/${label}/"... "
mkisofs -dvd-video -V "${label}" -o "${BACKUPPATH}/${title}.iso" "${TMP}/${label}/" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while creating a DVD image."
	echo "Press any key to exit."
	read
	exit
fi

echo -n "Removing temporary files from "${TMP}/${label}/"... "
rm -R "${TMP}/${label}/" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while removing temporary files."
	echo "Press any key to exit."
	read
	exit
fi
echo
echo "All Finished."
read
rm "${LOG}"
exit 0