Shell Script from Web

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 [at] output = system("install_my_profile.sh <parameters>");

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
saurabhperiwal [ Mi, 02 Januar 2008 14:24 ] [ ID #1897687 ]

Re: Shell Script from Web

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.
Burkhard Ott [ Mi, 02 Januar 2008 14:55 ] [ ID #1897688 ]

Re: Shell Script from Web

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 [at] output = system("install_my_profile.sh <parameters>");
>

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.
Cyrus Kriticos [ Mi, 02 Januar 2008 15:20 ] [ ID #1897689 ]

Re: Shell Script from Web

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

[at] 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 [at] localhost
identified by 'duper'" [this grants privileges]

Thanks again,
Saurabh

On Jan 2, 7:20 pm, Cyrus Kriticos <cyrus.kriti... [at] googlemail.com>
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 [at] output = system("install_my_profile.sh <parameters>");
>
> 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.
saurabhperiwal [ Do, 03 Januar 2008 12:06 ] [ ID #1898546 ]
Linux » comp.unix.shell » Shell Script from Web

Vorheriges Thema: (screen) problem with terminal wraparound
Nächstes Thema: simple trap syntax