LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 10-09-2006, 04:09 PM   #1
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 524

Rep: Reputation: 30
Using PHP, run bash script and see results on Server's Monitor


Hello, I'm making a digital picture frame out of an old laptop and I'm setting up Gallery (a php photo gallery organizer) so that I can manage the photos via a nice web interface. I want to add a few links to the php site so that you can start/stop/turnoff/etc the picture frame.

How do I run those already configured scripts that lie on the server?

-Thanks
 
Old 10-10-2006, 07:06 AM   #2
fozner
Member
 
Registered: Aug 2006
Posts: 147

Rep: Reputation: 16
As far as I know, php can only send output to one interface at a time. However, you can shell to an external program (which can even be a php script if your system is configured to run php scripts from the command line and php is in the path... This is very confusing and nobody does it that way.)

Your laptop "server" should already be set u to allow the exec family of functions, configured in php.ini but it might conceivably be disabled on some systems.

There are lots of ways to do this. You can, for example, write a copy of the album and then exec ('htmlview file://album.php'); to cause a web page to pop up that file on the server's screen... Or you could make it an auto-refreshing page and simply update it now and then... Or you could put the contents in a database and updated the database. Same effect.

I did something similar on my site, only I have it where visitors can draw a picture using javascript, which is saved in a database. From there the image data is sent via serial cable and displayed on an electronic sign for all to see. Naturally, some people will draw dirty pictures but the detail is not that great.

BetaBrite™ Graphical Guestbook: Display your message on our sign.
http://thenerdshow.com/betaimg.php?image=20
 
Old 10-10-2006, 11:50 AM   #3
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 524

Original Poster
Rep: Reputation: 30
I guess, more or less, it's not really a php script that will run serverside, it's just a link on the php page that when clicked will run a bash script (or something similar) on the server. I'd be able to reboot the server, shutdown, and do lots of things via this function, even open a firefox browser on the server (which is logged in as one of its users and running X)

-I think you have the idea, but what would I do to run my ".sh" script for example?

-Thanks
 
Old 10-11-2006, 06:03 PM   #4
fozner
Member
 
Registered: Aug 2006
Posts: 147

Rep: Reputation: 16
Sounds like you want to administer a server remotely. Try www.webmin.com
 
Old 10-11-2006, 06:48 PM   #5
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 524

Original Poster
Rep: Reputation: 30
Well, sort of. You see, i'm giving this as a gift to my parents and they don't know too much about computers, so I want to just have a page they can open (maybe type in a user and pass) and then be able to do a few simple tasks such as start a slideshow on the digital picture frame (there will be multiple slideshows they can run). Or let them run my little script that turns on/off the lcd (not shutdown/standby), or similar stuff like that.

I want to have like 3-4 tasks/scripts they can just click on and have the server run those processes/scripts. No interface needed because it would all be preconfigured. Webmin seems great, but way too complex for them to use.

Any ideas? Can I simplify webmin to do these things and sort of hide it from their view?
-Thanks
 
Old 10-12-2006, 12:56 AM   #6
fozner
Member
 
Registered: Aug 2006
Posts: 147

Rep: Reputation: 16
You didn't read the link I gave you in my first reply. PhP's exec function will let you run whatever scripts you want. Check into it and be sure to read the warnings: http://us2.php.net/function.exec

It's easy. Make a page with the exec function. Make another page with the button to press. Have the link in the button go to the page. I thought the php manual covered this topic pretty thoroughly but if you have any more questions there are plenty of people on this forum who can help out. Some of them will even write it for you. Alas, I must go work to feed the family.
 
Old 10-17-2006, 01:28 PM   #7
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 524

Original Poster
Rep: Reputation: 30
OK, I read it over a few times, and now i get it.

Pretty cool I must admit.
-Thanks for the help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run my bash script as a daemon. jaimese Linux - Newbie 12 02-10-2011 03:28 PM
php and bash script permissions paddyjoy Programming 2 10-04-2006 06:01 PM
Run Bash Script @ login XaViaR Linux - General 5 01-26-2006 10:05 PM
how to run one bash script from within another? babag Programming 9 04-28-2005 12:12 AM
Run script at login instead of bash uzi4u Linux - General 2 04-28-2004 02:31 PM


All times are GMT -5. The time now is 07:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration