> -----Original Message-----
> From: Soheil Shaghaghi [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 2:48 PM
> To: [EMAIL PROTECTED]
> Subject: running tar from a browser
> 
> 
> Hello everyone.
> 
> Here is my problem, if anyone can please help me:
> Running, Linux.
> I am trying to write a simple backup program to backup the data from a
> directory.
> The script works from the command line.
> But when I try to run the same script from the browser, it 
> doesn't work.
> I get this message:
> "Data could not be backed up.
> Exited with the following message: No such file or directory"
> 
> The error logs say:
> tar: backup.tar: Permission denied
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       This is the relevant problem

> tar: Error is not recoverable: exiting now
> 
> Can anyone please help me?
> 
> 
> Here is the contents of the script:
> #!/usr/bin/perl
>       my
> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$c
> time,$blksize,
> $block);
>       my $command1 = "tar cvf backup.tar members templates reviews";

You need to change directories. This is probably running from your
cgi-bin directory, which the web server doesn't have (or need) write 
access to. Is cgi-bin where members, templates, and reviews are kept?

The directory you switch to must be writable by the web server in
order to create backup.tar, or you will have to specify a directory
that *is* writable.

> 
>       system($command1);
> 
> 
> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$c
> time,$blksize,
> $block) = stat "backup.tar";
> 
>       my $DAT_SIZE = $size;
> 
>       print "Content-Type: text/html\n\n";
> 
>       if (-e "backup.tar") {
>               print "<CENTER><H1>Backup
> complete.</H1></CENTER><BLOCKQUOTE><BLOCKQUOTE>\n";
>               print "<H4>We recommend that you download the 
> <BLOCKQUOTE><A
> HREF=\"backup.tar\">Data Backup File ($DAT_SIZE 
> Bytes)</A></BLOCKQUOTE>to
> your local computer for safe keeping...</H4>\n";
>               print "</CENTER><BLOCKQUOTE>Note: The backup 
> file (backup.tar) is in the
> same directory as your CGI Programs Data.  It is possible 
> that you may not
> be able to download it using the link above (.cgi-bin 
> directories will not
> allow downloads from them).  If you cannot download it with 
> the provided
> link, we recommend that you FTP into your server and retreive the file
> manually.</BLOCKQUOTE></BLOCKQUOTE>\n";
>       }
>       else {
>               print "<CENTER><H1>Data could not be backed up.</H1>\n";
>               print "<H4>Exited with the following message: 
> $!</H4>\n";
>       }
> 
>       exit 0;
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to