Re: Newbie: star exit codes

Joerg Schilling <[email protected]> Mon, 12 Dec 2005 18:55:21 +0100
Newsgroups gmane.comp.archivers.star.user
Message-ID <439DB989.nailAJ411E5OU@burner>
prasad jlv <[email protected]> wrote:

> I am trying to develop a simple key files backup  script using star and I have RTFM but I have a few questions about exit  codes from star. I need to able to capture actual errors and ignore  warnings. Let's say I want the script to fail for anything other than 0  exit code.

man star -> EXIT STATUS
   
>   Here's what I am trying to do 
>   (a very simple example):
>   
>   Let's assume that I wish to backup the following directory:
>   bash-3.00# find . -ls
>   13642    1 drwxr-xr-x   3  root      other         512 Dec  9  13:22 .
>   13643    1 drwxr-xr-x   2  root      other         512 Dec  9  21:18 ./dir1
>   13644    1 -rw-r--r--   1  root      other          14  Dec  9 21:17 ./dir1/file1
>   13661    1 -rw-r--r--   1  root      other          14  Dec  9 21:18 ./dir1/file2
>   13645    1 lrwxrwxrwx   1  root      other           4  Dec  9 13:21 ./dir2 -> dir1
>   13646    1 lrwxrwxrwx   1  root      other           4  Dec  9 13:22 ./dir3 -> dir2
>   
>   So I do this:
>   bash-3.00# star -c . f=../star_test.star 
>   star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
>   
>   and I verify that everything looks good:
>   bash-3.00# star -tv f=../star_test.star 
>         0 drwxr-xr-x  root/other Dec  9 13:22 2005 ./
>         0 drwxr-xr-x  root/other Dec  9 21:18 2005 dir1/
>        14 -rw-r--r--  root/other Dec  9 21:17 2005 dir1/file1
>        14 -rw-r--r--  root/other Dec  9 21:18 2005 dir1/file2
>         0 lrwxrwxrwx  root/other Dec  9 13:21 2005 dir2 -> dir1
>         0 lrwxrwxrwx  root/other Dec  9 13:22 2005 dir3 -> dir2
>   star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
>   
>   Then I have added some files : 
>   bash-3.00# touch dir1/file3
>   bash-3.00# touch dir1/file4
>   
>   and then after a few days I want to restore my original files, so I do this:
>   bash-3.00# star -xUp f=../star_test.star   
>   star: File 'dir2' not removed.
>   star: File exists. Cannot create symbolic link 'dir2' to 'dir1'.
>   star: File 'dir3' not removed.
>   star: File exists. Cannot create symbolic link 'dir3' to 'dir2'.
>   star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
>   star: The following problems occurred during archive processing:
>   star: Cannot: stat 0, open 2, read/write 0. Size changed 0.
>   star: Missing links 0, Name too long 0, File too big 0, Not dumped 0.
>   star: Processed all possible files, despite earlier errors.
>   bash-3.00# echo $?
>   254

RTFM....
if you do not specify any of the -*remove* options, star will not remove files.

Jörg

-- 
 EMail:[email protected] (home) Jörg Schilling D-13353 Berlin
       [email protected]		(uni)  
       [email protected]	(work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily