[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: backup



On Tue, Mar 06, 2001 at 07:41:50PM -0300, Cosmo wrote:
> 
> # Monta o diretorio backup do micro Internet o linux atraves do Samba
> mount -t smbfs -o username=backup,password=backup //backup/backup /mnt/backup/

hau! =)

o mount provavelmente retorna erro caso a montagem falhe, entaum
basta checar a variavel $? para um valor de acerto/erro =)

olha soh:

[kov]@[/] # ls nada
ls: nada: Arquivo ou diretório não encontrado
[kov]@[/] # echo $?
1
[kov]@[/] # ls boot/vmlinuz
boot/vmlinuz@
[kov]@[/] # echo $?
0
[kov]@[/] # 

entaum:

-- cut here --
#!/bin/bash

ls /nada > /dev/null 2>&1

if [ $? != 0 ]; then
	echo "arquivo não encontrado"
else
	echo "arquivo encontrado"
fi

-- cut here -- 

> 
> # Faz a copia do bancos de dado do MySQL
> cp -r -u /usr/local/mysql/var/ /mnt/backup
> 
> # Faz a copia dos arquivos do diretorio www
> cp -r -u /home/www/ /mnt/backup
> 
> # Desmonta o diretorio /mnt/backup
> smbumount /mnt/backup

voce devia ler mais howtos e manpages =)

/usr/doc/HOWTO/en-txt/Bash-Prog-Intro-HOWTO.txt.gz

apt-get install doc-linux-text

[]s!

-- 
Gustavo Noronha Silva - kov
/*******************************************************  .''`.
* http://www.metainfo.org/kov			       * : :'  :
* GPG Key: http://www.metainfo.org/kov/html/pgp.html   * `. `'`
* http://www.brainbench.com/transcript.jsp?pid=2448987 *   `-
*******************************************************/ Debian

Attachment: pgpKKDQtrzN65.pgp
Description: PGP signature


Reply to: