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. :g:
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.
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.
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.
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? :|
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, ...