User:Kjogi: Difference between revisions

From ICO wiki
Jump to navigationJump to search
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…'
 
Kjogi (talk | contribs)
Line 1: Line 1:
==Quest2==
==Quest10.1==
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash

Revision as of 09:49, 20 May 2011

Quest10.1

<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