Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Unzip without telneting

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
How can I run Unzip/Gunzip/PKUnzip remotely without telneting into the server.

What I want to do is to upload files then click on a web page that run the unzip command.

There are perl and PHP scripts than send some console command via a page, but I can't find one that will run unzip.

If its not possible to run the command because of security or because it is interactive could I not create a batch file on the server and then run activate the batch file via perl / php?

PS
How do I create and run a batch file on a Linux server?

Cheers.
 
A perl script that runs via CGI or a PHP script should be pretty simple to set up. All you would need to do is pass the path to the file to be uzipped in a form and then do a system call to unzip.

This is terribly insecure but you could tighten it up by password protecting the page. Also the webserver would have to be on the same machine as where you upload the files.

Good Luck
--
Scott

 
Ok, I think I have a better idea now. I have discovered Crontab is like a batch job scheduler which should do the job.

Basically I upload zipped data files to the server everynight and then telnet to unzip. The upload takes a couple of hours so I'd like to automate it rather than wait and then manually run an unzip.

Can you tell me how to create a batch file that will do the following (note I'm a whiz with DOS batch files, don't even know how you create or edit a Linux batch file!)

if exist uploaded_ok_flg
unzip -ext -over=all newfiles.zip
rename uploaded_ok_flg unzipped_ok_flg
endif

Cheers
 
That's about right, basically it's

#!/usr/bin/perl

system("unzip -ext -over=all newfiles.zip")
system("mv uploaded_ok_flg unzipped_ok_flg") if open(TEST, "/path/to/newfiles.zip");





Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top