Friday, September 24, 2010

Re: Execute Linux commands from controller

And also try with passthru.

On Fri, Sep 24, 2010 at 2:53 PM, euromark <dereuromark@googlemail.com> wrote:
yours is probably related to
http://groups.google.com/group/cake-php/browse_thread/thread/c8665b6c098e2059

not having the "right" to execute this as apache script (having group
www-data)


On 24 Sep., 13:44, Urs <ajnur...@gmail.com> wrote:
> I am trying to execute the script scriptos.sh :
>
> #!/bin/bash
> ssh t...@192.168.1.30 "cat /proc/version | sed 's/ //g' | cut -d'(' -
> f4 | cut -c1-6" > osdetails
> cat osdetails
>
> Here, I m finding the type of OS and echoing it..
>
> I m calling the script by : exec('../shellscripts/scriptos.sh', $os);
>
> If the script is executed directly from the terminal, i get the
> correct result. But if i call it from cake, i dont get any output..
>
> On Sep 22, 11:30 am, Andrei Mita <andrei.m...@gmail.com> wrote:
>
>
>
> > Can you give us an example of what are you trying to do?
>
> > I have developed in the past a small network monitor app and I didn't had
> > very nice experiences with running commands. Some work great, some can crash
> > your app due to execution time.
>
> > On Wed, Sep 22, 2010 at 7:33 AM, Urs <ajnur...@gmail.com> wrote:
> > > Thanks Andrel & Skimmas. This worked for the basic commands.. Any idea
> > > how to execute server login commands such as ssh & scp?
>
> > > Regards,
> > > Arjun Urs
>
> > > On Sep 20, 3:53 pm, Andrei Mita <andrei.m...@gmail.com> wrote:
> > > > I don't know if CakePHP has something special in place for executing
> > > > commands but exec and passthru will definitely work:
> > >http://www.php.net/manual/en/ref.exec.php
>
> > > > On Mon, Sep 20, 2010 at 1:10 PM, Urs <ajnur...@gmail.com> wrote:
> > > > > Hi..
>
> > > > > How can we execute linux commands from the controller?
>
> > > > > like:
> > > > > Example1: cat file1.txt
> > > > > Example2: ifconfig | grep eth | awk {'print $1'}
>
> > > > > Plz help..
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > > with their CakePHP related questions.
>
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.c om>
> > > <cake-php%2Bunsubscribe@googlegroups.com<cake-php%252Bunsubscribe@googlegro ups.com>>For
> > > more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.c om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: