Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Problems while running Bash script with Perl

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-09-2010
Member
 
Join Date: Apr 2010
Posts: 57
Problems while running Bash script with Perl
  

I try on a openSUSE 11.3 server is a bash script using Perl / CGI to run. Unfortunately, this does not work like I want it. Not at all. My Perl script is as follows :
Code:
 #! / Usr / bin / perl-w

 use strict;
 use CGI:: Carp qw (fatalsToBrowser);

 print "Content-type: text / html \ n \ n";

 $ SIG (CHLD) = 'IGNORE';
 unless (fork ()) (
     exec ('/ bin / test.sh');
     exit (0);
 )
I think that there would be someone who can help in solving my problem that I am facing while running Bash script with Perl. I think that I am clear enough to explain my query.

Reply With Quote
  #2  
Old 02-09-2010
Member
 
Join Date: Feb 2006
Posts: 167
Re: Problems while running Bash script with Perl

I am having much queries on your problem. If the file because / adapted touch? How do you call the script from the console? What are the permissions of the scripts so far? I think that you should be definitely using the test.sh file. So I would like to recommend you to provide the test.sh file, so that it could be easy for us to understand. Also there are chances that you might be using the coding of test.sh file incorrectly.
Reply With Quote
  #3  
Old 02-09-2010
Member
 
Join Date: Apr 2010
Posts: 57
Re: Problems while running Bash script with Perl

Quote:
I think that you should be definitely using the test.sh file. So I would like to recommend you to provide the test.sh file, so that it could be easy for us to understand.
The test.sh file looks like this:
Code:
 # / Bin / bash

 test touch /
 echo "a test">> / test
 mv / test / srv / www / test
 cat / srv / www / test
These are just test scripts. If the work, the right can be used. These will replace the smb.conf by another and then restart the Samba service. Is this any way to the permissions? And if so, where do I put what? The script can test.sh through the console to run properly. And the perl script reports no errors.

Thanks in advance.
Reply With Quote
  #4  
Old 02-09-2010
Member
 
Join Date: Feb 2006
Posts: 167
Re: Problems while running Bash script with Perl

And yet a basic question ... why even use bash? You can and should do EVERYTHING with a language and system calls to avoid. Otherwise, my guess is that your apache is running with a rating of your perl script can run your bash script, respectively incorrect. Debug but the best times in the shell, ie lead your perl script out by hand and not via the browser. Also I think that using the chown the data folders / files, so it fits with the httpd process will help you.
Reply With Quote
  #5  
Old 02-09-2010
Member
 
Join Date: Apr 2010
Posts: 57
Re: Problems while running Bash script with Perl

The whole thing is designed for use in a classroom. There is an openSUSE 11.2 with Samba. The user should be able to use during class their usual drives, but during the tests will be different given the drives. Therefore, the change of the smb.conf. After the test back to the old shares will be made (that will again change the smb.conf) and also all the files from the Test folder to a new folder will be copied. The shell scripts to create FUNZ fine. But I can allow the teachers of this area can not access the server. Therefore, I wanted to make remotely run the scripts through the browser. Another possibility I have not found yet.

Or it may be possible to realize all of Webmin? It is to be executed with a click, you can (after you have logged in with a password), so that I must deposit because none of the system commands just in Perl?
Reply With Quote
  #6  
Old 02-09-2010
Member
 
Join Date: Dec 2008
Posts: 128
Re: Problems while running Bash script with Perl

Quote:
And as I sit without the whole system commands just in Perl?
By repairing your bash script in Perl ported. There is no copy command is also available in Perl, as well as you can then create and delete files. Basically, it does not change the fact that your Web server process runs under a specific user. Most unpriveligiertem a tear open to security breaches. And this user runs your perl script, of course with the privileges of the webserver process. So you have to give this user the right to edit your smb.conf. There are several possibilities, for example smb.conf adjust rights, setuid, SUDO, ...
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problems while running Bash script with Perl"
Thread Thread Starter Forum Replies Last Post
How to create CGI script in bash? Mulan Software Development 5 01-09-2010 08:19 PM
Create bash script for ftp teenQ Operating Systems 4 04-03-2010 06:37 PM
Bash script if then else help Unix'EM Software Development 3 18-08-2009 06:34 PM
Is it possible to execute Perl script within another script? RasMus Software Development 2 21-07-2009 10:57 PM
Bash Script, read without new line Kieran Software Development 2 06-02-2009 08:59 PM


All times are GMT +5.5. The time now is 02:54 PM.