Current File : //bin/smbtar
#!/bin/sh
#
# smbtar script - front end to smbclient
#
# Authors: Martin.Kraemer <[email protected]>
#          and Ricky Poulten ([email protected])
#
# (May need to change shell to ksh for HPUX or OSF for better getopts)
#
# sandy nov 3 '98 added -a flag
#
# Richard Sharpe, added -c 'tarmode full' so that we back up all files to
# fix a bug in clitar when a patch was added to stop system and hidden files
# being backed up.

case $0 in
    # when called by absolute path, assume smbclient is in the same directory
    /*)
	SMBCLIENT="`dirname $0`/smbclient";;
    *)  # you may need to edit this to show where your smbclient is
	SMBCLIENT="smbclient";;
esac

# These are the default values. You could fill them in if you know what
# you're doing, but beware: better not store a plain text password!
server=""
service="backup"            # Default: a service called "backup"
password=""
username=$LOGNAME           # Default: same user name as in *nix
verbose="2>/dev/null"        # Default: no echo to stdout
log="-d 2"
newer=""
newerarg=""
blocksize=""
blocksizearg=""
clientargs="-c 'tarmode full'"
tarcmd="c"
tarargs=""
cdcmd="\\"
tapefile=${TAPE-tar.out}

Usage(){
    ex=$1
    shift
echo >&2 "Usage: `basename $0` [<options>] [<include/exclude files>]
Function: backup/restore a Windows PC directories to a local tape file
Options:         (Description)                 (Default)
  -r             Restore from tape file to PC  Save from PC to tapefile
  -i             Incremental mode              Full backup mode
  -a             Reset archive bit mode        Don't reset archive bit
  -v             Verbose mode: echo command    Don't echo anything
  -s <server>    Specify PC Server             $server
  -p <password>  Specify PC Password           $password
  -x <share>     Specify PC Share              $service
  -X             Exclude mode                  Include
  -N <newer>     File for date comparison      `set -- $newer; echo $2`
  -b <blocksize> Specify tape's blocksize      `set -- $blocksize; echo $2`
  -d <dir>       Specify a directory in share  $cdcmd
  -l <log>       Specify a Samba Log Level     `set -- $log; echo $2`
  -u <user>      Specify User Name             $username
  -t <tape>      Specify Tape device           $tapefile
"
  echo >&2 "$@"
  exit $ex
}

# echo Params count: $#

# DEC OSF AKA Digital UNIX does not seem to return a value in OPTIND if 
# there are no command line params, so protect us against that ...
if [ $# = 0 ]; then

  Usage 2 "Please enter a command line parameter!"

fi

while getopts riavl:b:d:N:s:p:x:u:Xt: c; do
  case $c in
   r) # [r]estore to Windows (instead of the default "Save from Windows")
      tarcmd="x"
      ;;
   i) # [i]ncremental
      tarargs=${tarargs}ga
      clientargs="-c 'tarmode inc'"
      ;;
   a) # [a]rchive
      tarargs=${tarargs}a
      ;;
   l) # specify [l]og file
      log="-d $OPTARG"
      case "$OPTARG" in
	[0-9]*) ;;
	*)      echo >&2 "$0: Error, log level not numeric: -l $OPTARG"
		exit 1
      esac
      ;;
   d) # specify [d]irectory to change to in server's share
      cdcmd="$OPTARG"
      ;;
   N) # compare with a file, test if [n]ewer
      if [ -f $OPTARG ]; then
	newer=$OPTARG
	newerarg="N"
      else
	echo >&2 $0: Warning, $OPTARG not found
      fi
      ;;
   X) # Add exclude flag
      tarargs=${tarargs}X
      ;;
   s) # specify [s]erver's share to connect to - this MUST be given.
      server="$OPTARG"
      ;;
   b) # specify [b]locksize
      blocksize="$OPTARG"
      case "$OPTARG" in
	[0-9]*) ;;
	*)      echo >&2 "$0: Error, block size not numeric: -b $OPTARG"
		exit 1
      esac
      blocksizearg="b"
      ;;
   p) # specify [p]assword to use
      password="$OPTARG"
      ;;
   x) # specify windows [s]hare to use
      service="$OPTARG"
      ;;
   t) # specify [t]apefile on local host
      tapefile="$OPTARG"
      ;;
   u) # specify [u]sername for connection
      username="$OPTARG"
      ;;
   v) # be [v]erbose and display what's going on
      verbose=""
      ;;
   '?') # any other switch
       Usage 2 "Invalid switch specified - abort."
      ;;
  esac
done

shift `expr $OPTIND - 1`

if [ "$server" = "" ] || [ "$service" = "" ]; then
  Usage 1 "No server or no service specified - abort."
fi

# if the -v switch is set, the echo the current parameters
if [ -z "$verbose" ]; then
      echo "server    is $server"
#     echo "share     is $service"
      echo "share     is $service\\$cdcmd"
      echo "tar args  is $tarargs"
#     echo "password  is $password"  # passwords should never be sent to screen
      echo "tape      is $tapefile"
      echo "blocksize is $blocksize"
fi

tarargs=${tarargs}${blocksizearg}${newerarg}

eval $SMBCLIENT "'\\\\$server\\$service'" "'$password'" -U "'$username'" \
-E $log -D "'$cdcmd'" ${clientargs} \
-T${tarcmd}${tarargs} $blocksize $newer $tapefile '${1+"$@"}' $verbose
blog

blog

Meilleur Casino en ligne 2025 – Classement complet.6745

Содержимое Les meilleurs casinos en ligne pour jouer en 2025 Les casinos en ligne français légaux Les nouveaux casinos en ligne Comment choisir le meilleur casino en ligne pour vous Meilleur Casino en ligne 2025 – Classement complet Les casinos en ligne sont devenus très populaires ces dernières années, offrant …

Read More »

Neue Online Casinos in Deutschland.346

Neue Online Casinos in Deutschland ▶️ SPIELEN Содержимое Die Top 5 Neuen Online Casinos in Deutschland Wie funktionieren Online Casinos in Deutschland? Das Online Casino Testbericht Die Vorteile von Online Casinos in Deutschland Mobile Online Casinos in Deutschland Die Online-Casinos-Szene in Deutschland ist ständig in Bewegung. Neue Anbieter kommen auf …

Read More »

Erfahrungen mit Online Casinos in Deutschland.21

Erfahrungen mit Online Casinos in Deutschland ▶️ SPIELEN Содержимое Die Vorteile von Online-Casinos Flexibilität Wahlmöglichkeiten Sicherheit Die Bedenken und Risiken Die Risiken von Online-Casinos Wie wählt man das richtige Online-Casino aus? Top Online Casinos in Deutschland Online Casinos in Deutschland – Ein Überblick Die wichtigsten Regeln und Vorschriften für Online …

Read More »

Meilleur Casino en ligne 2025 – Classement complet.4306

Содержимое Les meilleurs casinos en ligne pour jouer en 2025 Comment choisir le meilleur casino en ligne pour vous Les critères pour choisir le meilleur casino en ligne Meilleur Casino en ligne 2025 – Classement complet Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience …

Read More »

Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables.4313

Содержимое Les Critères de Sélection Les Meilleurs Casinos en Ligne 2025 Les Critères de Sélection Les Meilleurs Casinos en Ligne 2025 Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience de jeu en ligne …

Read More »

Chicken Road slot w kasynie online jak grać.791

Содержимое Wprowadzenie do gry Chicken Road Slot Zasady gry i bonusy w grze Chicken Road Chicken Road slot w kasynie online – jak grać Wśród wielu slotów, które możemy znaleźć w kasynach online, jeden z nich wyróżnia się swoją oryginalnością i fascynującą atmosferą – chicken road . To nie tylko …

Read More »

Chicken Road slot w kasynie online dostępność mobilna.875

Содержимое Wprowadzenie do gry Chicken Road Slot Wymagania gry Jak grać w Chicken Road Slot? Zasady gry i bonusy w grze Chicken Road Wyniki testu: jak gra się w mobilnym wersji Chicken Road Slot Chicken Road slot w kasynie online – dostępność mobilna Wśród wielu slotów dostępnych w kasynach online, …

Read More »

Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables.2758

Содержимое Les Meilleurs Casinos en Ligne pour les Joueurs Français Meilleur Casino en Ligne 2025 – Top 10 des Casinos Fiables Les casinos en ligne sont devenus très populaires ces dernières années, offrant une expérience de jeu en ligne sécurisée et amusante. Mais comment choisir le meilleur casino en ligne …

Read More »