User:Kjogi

From ICO wiki
Revision as of 09:48, 20 May 2011 by Kjogi (talk | contribs) (Created page with '==Quest2== <source lang="bash"> #!/bin/bash #Autor: Kalev Jõgi #Rühm: A22 #Versioon: 1.0 #Kuupäev: 20.05.2011 # Kontrollime, kas varunduse kaust on olemas, kui pole, siis loo…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Quest2

<source lang="bash">

  1. !/bin/bash
  2. Autor: Kalev Jõgi
  3. Rühm: A22
  4. Versioon: 1.0
  5. Kuupäev: 20.05.2011
  1. Kontrollime, kas varunduse kaust on olemas, kui pole, siis loome

if [ -e /var/varukoopiad ]; then

echo "Varukoopiate kataloog on olemas"

else

echo "Loome varukoopiate kataloogi"
mkdir /var/varukoopiad

fi

  1. Teeme varukoopia

NOW=$(date +"%d%b%y") HOST=$HOSTNAME FILENAME=$NOW"-mysql-"$HOST".sql" mysqldump --user=root --password=kalev -A > /var/varukoopiad/$FILENAME

  1. Kontrollime, kas varukoopia tegemine õnnestus, kui õnnestus,
  2. siis pakime koopiafaili kokku

if [ -e /var/varukoopiad/$FILENAME ]; then

echo "Varukoopia tegemine õnnestus"
gzip /var/varukoopiad/$FILENAME

else

echo "Varukoopia tegemine ei õnnestunud"

fi