Strick’s Ramblings

My Scripts

This is the backup script I use.

#! /bin/bash
 
#|----------------------------------------|
#|                                        |
#| Basic Backup Script, using tar	  |
#|					  |
#| written by:  James Strickland	  |
#|					  |
#|----------------------------------------|
 
# name variables
 
targetdir="/mnt/backup"
backupdir="/home/james"
DT=home-james-$(date +%m.%d.%y)-backup.tar.gz
 
# backup using tar with gzip compression
 
###############################################
# tar switches explained...
# c = Create
# v = Verbose
# z = Gzip Compression
# p = Same permissions
# S = Handle Sparse Files efficiently
# f = Filename (compressed filename)
# s = Same order / preserve order
################################################
 
# NOTE:  '-Z' is verify written data I don't have
#        that enabled, but may enable for future.
 
time tar cvzpSfs $targetdir/$DT $backupdir
# time tar -ur $targetdir/home-james* $backupdir
 
echo " "
echo " "
echo " "
echo "backing up files complete!!"
echo " "
echo " "

A script to convert all .mod files (sony camcorder) to .flv

#!/bin/bash
 
##############################
# VIDEO CONVERTER  (FLV)     #
# gi_james@strickstuff.com   #
# www.strickstuff.com        #
############################## 
 
# all files that start with .m (eg mpeg mpg mod) 
 
    # change to whatever you want... 
 
for file in ./*.mod; 
 
# encode files and rename them to FLV 
 
do ffmpeg -i $file -ar 22050 -ab 32 -f flv -s 640x480 -y ${file%.m*}.flv 
 
# all done! 
 
done

OLVIMS_REPORT_v.2.01

Sub OLVIMS_Report()
 
' ======================================
' DECLARE
' ======================================
Dim ws As Worksheet
Dim rng As Range, rng_area As Range
Dim str_wb As String
' ======================================
' TURN OFF SCREEN UPDATES
' ======================================
Application.ScreenUpdating = False
' ======================================
' ASSIGN etc
' ======================================
Set ws = ThisWorkbook.Sheets("ClosedDispatchRequests")
str_wb = "\\SERVERNAME\35 LRS\LGRD\LGRDDO\Dispatch Operations\Dispatch REPORTS\2- Closed Dispatch Request\" & Year(Date) & "\" & Format(Date, "MMM YY") & ".xls"
 
' ======================================
' DO THE PREP WORK
' ======================================
ActiveWindow.Zoom = 85
ws.Rows("1:4").Delete Shift:=xlToLeft
ws.Columns("A:A").Delete Shift:=xlToLeft
On Error Resume Next
ws.Columns("I:I").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
 
' Change REG Number column to TEXT so MHE
' Numbers will display correctly
 
ws.Columns("O:O").NumberFormat = "@"
' Selection.NumberFormat = "@"
 
' ======================================
' GET RID OF ALL OCCURRENCES OF PAX
' THEN DELETE THOSE ROWS
' ======================================
ws.Cells.Replace What:="PAX", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
On Error Resume Next
ws.Columns("H:H").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
 
' ======================================
' AUTOFIT ALL
' ======================================
 
    Columns("A:Z").EntireColumn.AutoFit
 
' =========================================
' COPY DATA & PASTE ON MONTH SUMMARY SHEET
' =========================================
 
ws.Range("A1:P500").Copy
Workbooks.Open str_wb
Sheets(CStr(Day(Date))).Range("A2").PasteSpecial xlPasteValues
Sheets(CStr(Day(Date))).Columns("G:G").NumberFormat = "h:mm"
Sheets(CStr(Day(Date))).Columns("I:N").NumberFormat = "h:mm"
 
ActiveWorkbook.Close SaveChanges:=True
Application.CutCopyMode = False
 
' =========================================
' EXIT POINT
' =========================================
ExitHere:
' =========================================
' RELEASE
' =========================================
Set ws = Nothing
' ======================================
' RESTORE SCREEN UPDATES
' ======================================
Application.ScreenUpdating = True
' =========================================
' END
' =========================================
Exit Sub
 
' =========================================
' HANDLER
' =========================================
NoData:
MsgBox "No Data - Routine Terminated", vbCritical, "Fatal Error"
Resume ExitHere:
Exit Sub
 
End Sub

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!