script need

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Jan 8 22:23:01 EET 2001


[ mail reformatted - to reply htan pano apo to replied keimeno! ]

On Mon, Jan 08, 2001 at 12:25:59PM +0200, Nick Apostolakis wrote:
> On Fri, 29 Dec 2000, D.A.Glynos wrote:
>> On Fri, 29 Dec 2000, Nikos Zounis wrote:
>>> Yparxei kanena script pou na xrisimopiei to output tis entolis (i paromio)
>>> smbclient -L <host>
>>> wste automata na kanei mount/umount ola ta shares tou kathenos user ?
>>
>> psakse gia to xsmbrowser sto freshmeat.
>> Den kanei automata mount/umount akrivws... alla miazei
>> me to concept tou network neighbourhood twn winblowz.
> 
> egw xrisimopoiw to linneighborhood sta x pou moiazei poly me to windows
> neighborhood.
> 
> einai arketa stathero kai efxristo
> mporeis na to vreis sto freshmeat

Eixa dokimasei to linneighborhood alla eixe duo meionekthmata:

  a) Den paizei se FreeBSD pou to h8ela, giati xrhsimopoiei to smbmount, enw
     ego h8ela na paiksei me to sharity-light pou exei to BSD mou.

  b) Den h8ela na kanei ola ta shares mount, alla mono auta pou tha tou po
     ego, kai me sugkekrimeno tropo sto disko.

     Auto den to ekane otan to eixa dokimasei (h den to brhka egw).  Opote
     katefuga stin lush `script the hell out of it's ass', kai ekana auto pou
     peirgrafetai parakato :-)

Exo ena topiko lan opou ta shares pou kanoun ta mhxanhmata einai kurios gia
logous backup.  Gia na pairno backup ta Windows PC xoris na kathomai se ena
ena jexorista na kano copy apo to explorer ta arxeia twn diskwn tous.

Sto BSD pou exei to rolo tou backup box uparxei to ejhs:

        # cd /samba
        # ls -F
        andreas/                giorgos/
        eleni/                  yiannis/
        zeus/                   uranus/
        # ls giorgos
        drives/                 shares/
        # ls -l giorgos/drives
        drwxr-xr-x   3 root     wheel       512 Oct 19 01:24 c:
        drwxr-xr-x   3 root     wheel       512 Oct 19 01:24 d:
        drwxr-xr-x   3 root     wheel       512 Oct 19 01:25 e:
        # ls scripts
        mount_andreas           mount_giorgos           mount_eleni
        mount_yiannis           mount_zeus              mount_uranus
        mount.servers           mount.workstations      mount.all
        umount_andreas          umount_giorgos          umount_eleni
        umount_yiannis          umount_zeus             umount_uranus
        umount.servers          umount.workstations     umount.all

1) Ta mount_XXX script kanoun mount ta shares apo ena sugkekrimeno mhxanhma.
2) Ta mount.servers kai mount.workstations kanoun mount omades apo PC pou
   exoun ena sugkekrimeno `rolo'.
3) Ta umount_XXX to anapodo apo to antistoixo mount_XXX script.
4) Ta umount.XXX to anapodo apo to antistoixo mount.XXX script.

Auta kanoun mount akribws oti xreiazetai.  An to mhxanhma pou theloun na
kanoun mount einai down, to agnooun kai sunexizoun.  H `gnwsh' tou poio
mhxanhma exei poio share einai kommati tou script pou kanei mount ta shares
tou sugkekrimenou mhxanhmatos.

Nai katalabaino oti kapoios tha frikarei tora "ma ekatse kai egrapse custom
scripts gia na kanei mount/umount. einai trelllooooos?"

Etsi omws ginetai mount akribws oti thelw ego, kai ta passwords pou einai
sta scripts tou /samba/scripts den einai anagkh na ta dino ekeinh th stigmh
(profanws ta permissions epitrepoun mono sto `root' na dei ta arxeia tou
/samba/scripts).  Ase pou ta pio polla script einai copy/paste enos basikou
script, pou apla allazo ta onomata twn shares kai ta password kai to kano
rename sto katallhlo onoma (enhmerwnontas kai ta mount.XXX kai umount.XXX
scripts katallhla ennoeitai).

Ena mikro paradeigma tou giati ena tetoio setup.  Ma ti sto kalo na to kanei
pou kanei mount ta mhxanhmata me Samba, me ta dika tou scripts?

Etsi ena aplo crontab entry mporei na kanei pragmata opws:

        cd /samba
        sh scripts/mount.workstations || {
           # some workstations not mounted
           echo "Some workstations failed to mount.  Aborting."
           exit 1
        }

        # Pame me to kanoniko backup twra.
        cd /samba/uranus/f/backup
        cd /samba/giorgos/drives
        tar cvf - "c:" | gzip -9c - \
          > /samba/uranus/drives/f/backup/giorgos.drive.c.`date +"%Y.%m.%d.%H.%M"`tar.gz
        ...
        kai ta loipa...

Kai na exei sto backup disko tou uranus ena arxeio pou onomazetai
`giorgos.drive.c.2000.01.08.21.10.tar.gz' kai exei to backup tou diskou C: apo
to sugkekrimeno PC pou parthike stis 08/01/2000 wra 21:10.

Twra giati sas ta grafo auta tha mou peite.  Giati thelo na deikso pos an
theleis pragmatika mia lush rammenh kai kommenh sta dika sou metra kai
sta8ma, mallon prepei na baleis kamposa ergaleia pou einai hdh dia8esima se
opoiodhpote Unix na doulepsoune gia sena.  H 'enorxhstrosh' thelei ligo
sxediasmo, alla to apotelesma an to kaloskeftei kaneis metraei polu, kai poso
sou lunei ta xeria (h glitonei xrono) otan teleioseis :)

... apla mia idea pou thn eklepsa apo allou, tin proxorisa ligaki, kai tin
xrhsimopoiw kairo tora, gia na kano ta backup twn Win boxes mou me Samba.

Elpizo na min sas kourasa.

- giorgos




More information about the Linux-greek-users mailing list