Results 1 to 6 of 6

Thread: Problems while running Bash script with Perl

  1. #1
    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.

  2. #2
    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.

  3. #3
    Join Date
    Apr 2010
    Posts
    57

    Re: Problems while running Bash script with Perl

    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.

  4. #4
    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.

  5. #5
    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?

  6. #6
    Join Date
    Dec 2008
    Posts
    128

    Re: Problems while running Bash script with Perl

    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, ...

Similar Threads

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •