Shell Script from Web

Shell Script from Web

am 02.01.2008 14:24:10 von saurabhperiwal

Hi,

Background:
=======
I am running a shell script from my perl script (web page). Shell
script creates a file database.sql which then I use to create database
and table structure.

Code
====
Perl
-----
my @output = system("install_my_profile.sh ");

Shell Script [install_my_profile.sh]
--------------
echo -e $mysql>database.sql

this gives error permission denied, I have changed directory ownership
to apache:apache

Please help

Regards
Saurabh

Re: Shell Script from Web

am 02.01.2008 14:55:02 von Burkhard Ott

Am Wed, 02 Jan 2008 05:24:10 -0800 schrieb Saurabh:

> Hi,

Hello,

> Shell Script [install_my_profile.sh]
> --------------
> echo -e $mysql>database.sql
>
> this gives error permission denied, I have changed directory ownership
> to apache:apache

Permission denied comes afaik from you database, you will the apache user
in your database.

Re: Shell Script from Web

am 02.01.2008 15:20:35 von Cyrus Kriticos

Saurabh wrote:
>
> Background:
> =======
> I am running a shell script from my perl script (web page). Shell
> script creates a file database.sql which then I use to create database
> and table structure.
>
> Code
> ====
> Perl
> -----
> my @output = system("install_my_profile.sh ");
>

To debug add to your script:

> Shell Script [install_my_profile.sh]
> --------------

pwd
echo "$mysql"
set -x
> echo -e $mysql>database.sql
set +x

> this gives error permission denied, I have changed directory ownership
> to apache:apache

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.

Re: Shell Script from Web

am 03.01.2008 12:06:14 von saurabhperiwal

@ Burkhard Ott : Thanks, but there Im just trying to write an file
with extention .sql so it cant be a issue of MySQL rights.

@Cyrus Kriticos : Thanks, I took the decision to go other way, instead
of writing the sql file where I was putting commands to create
database and grant privileges and then running it in shell script. Now
Iam not creating that file instead I do this

mysqladmin -usuper -pduper create $profile [this creates database for
profile]
mysql -usuper -pduper -e "grant all on $profile.* to root@localhost
identified by 'duper'" [this grants privileges]

Thanks again,
Saurabh

On Jan 2, 7:20 pm, Cyrus Kriticos
wrote:
> Saurabh wrote:
>
> > Background:
> > =======
> > I am running a shell script from my perl script (web page). Shell
> > script creates a file database.sql which then I use to create database
> > and table structure.
>
> > Code
> > ====
> > Perl
> > -----
> > my @output = system("install_my_profile.sh ");
>
> To debug add to your script:
>
> > Shell Script [install_my_profile.sh]
> > --------------
>
> pwd
> echo "$mysql"
> set -x> echo -e $mysql>database.sql
>
> set +x
>
> > this gives error permission denied, I have changed directory ownership
> > to apache:apache
>
> --
> Best regards | Be nice to America or they'll bring democracy to
> Cyrus | your country.