[Tecnica] ... problemini africani ... ;)

Simone Soldateschi simone.soldateschi a gmail.com
Sab 16 Ott 2010 21:47:25 BST


2010/10/16 Paolo Sammicheli <xdatap1 a siena.linux.it>

> Alle 18:40 del 16/10/2010, Simone Soldateschi ha scritto:
> > controlla che esista il file './continua': se esiste allora esegue 'do
> stuff
> > here', altrimenti termina ;)
>
> Nè tu né Raul nell'altra mail avete risposto.
>

??


> Il problema è testare il codice di ritorno di un RSYNC, non l'esistenza di
> un file o una
> variabile.
>
> Nella manpage di RSYNC non ho trovato nulla, come si ricava l'esito del
> comando RSYNC?
>

in bash il codice di errore di qualsiasi programma si indica con:

    $?

quindi se, ad esempio, volessi sapere qual è il codice di errore restituito
dall'esecuzione di 'date':

    $ date && echo $?
    Sat Oct 16 22:45:50 CEST 2010
    0

Verificare l'esistenza di un file era esemplificativo, ed infatti l'ho fatto
con ls:

    ls continua

verificando poi il codice di errore di 'ls' con '$?' piuttosto che usare la
forma corretta per vedere se un file esiste:

    if [ -e continua ]; then ...

proprio per mostrare l'uso del codice di errore restituito da un programma
qualsiasi ;)

Per quanto riguarda i codici di errore restituiti da 'rsync' il man dice:

EXIT VALUES
       0      Success
       1      Syntax or usage error
       2      Protocol incompatibility
       3      Errors selecting input/output files, dirs
       4      Requested  action  not  supported:  an  attempt was made to
manipulate 64-bit files on a platform that cannot support them; or an option
was
              specified that is supported by the client and not by the
server.
       5      Error starting client-server protocol
       6      Daemon unable to append to log-file
       10     Error in socket I/O
       11     Error in file I/O
       12     Error in rsync protocol data stream
       13     Errors with program diagnostics
       14     Error in IPC code
       20     Received SIGUSR1 or SIGINT
       21     Some error returned by waitpid()
       22     Error allocating core memory buffers
       23     Partial transfer due to error
       24     Partial transfer due to vanished source files
       25     The --max-delete limit stopped deletions
       30     Timeout in data send/receive
       35     Timeout waiting for daemon connection


ciao


// SS
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://liste.siena.linux.it/pipermail/tecnica/attachments/20101016/7133cbf3/attachment.htm>


Maggiori informazioni sulla lista Tecnica