[7. June 2013] Youporn available now | [19. April 2013] A-400 Advanced Network Setup | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 RC1 [13 June 2013] | A-200/A-210 RC1 [13 June 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 2 Guest(s)
Thread Closed 
php exec() function and linux shell command
08-07-2009, 09:22 PM
Post: #16
RE: php exec() function and linux shell command
First i would try running the daemon.sh script by itself, just make sure its all legit
Code:
cd /share/Apps/Shutdown
./daemon.sh start

if running daemon.sh yourself gets the file copied over, then i think should be just fine. Also if something is already started use the following
Code:
/share/Apps/AppInit/appinit.cgi restart Shutdown

journey4712

Automated TV Downloads | On-Demand Network Shares | Faster PHP (lighttpd+fastcgi+apc)
PCH-A100 | PCH-C200 | XBMC HTPC | Sharp Aquos 42D62U | Logitech Z-5500
Find all posts by this user
08-07-2009, 10:36 PM
Post: #17
RE: php exec() function and linux shell command
(08-07-2009 09:22 PM)journey4712 Wrote:  First i would try running the daemon.sh script by itself, just make sure its all legit

Of course I should have thought of that ..doh Rolleyes

Yes the daemon script is perfect ( never doubted it Smile )
It copies over the shutdown.cgi file file.

So I deleted it for the next test and ran

Code:
/share/Apps/AppInit/appinit.cgi restart Shutdown

and the shutdown.cgi is still not getting copied over.
Which means CSI /appinit.cgi is not working.

Does CSI install a service/server of some type that will start at boot up ?
I gave been to Ger's website and nothing is mentioned.

What I don't get is: what causes appinit.cgi to run at boot up ?

I think I am missing something
Find all posts by this user
08-07-2009, 10:54 PM
Post: #18
RE: php exec() function and linux shell command
appinit.cgi is run whenever the ftp server is started/stopped. You can verify appinit is in there with a grep

Code:
grep appinit /mnt/syb8634/etc/ftpserver.sh

I cant think of why daemon.sh isn't starting for you, it always works locally for me. Just dig through a bit bound to find something Smile

journey4712

Automated TV Downloads | On-Demand Network Shares | Faster PHP (lighttpd+fastcgi+apc)
PCH-A100 | PCH-C200 | XBMC HTPC | Sharp Aquos 42D62U | Logitech Z-5500
Find all posts by this user
08-07-2009, 11:07 PM
Post: #19
RE: php exec() function and linux shell command
(08-07-2009 10:54 PM)journey4712 Wrote:  appinit.cgi is run whenever the ftp server is started/stopped. You can verify appinit is in there with a grep

Code:
grep appinit /mnt/syb8634/etc/ftpserver.sh

I cant think of why daemon.sh isn't starting for you, it always works locally for me. Just dig through a bit bound to find something Smile

journey4712

Ah ok now I get it. Yup appinit.cgi is in ftpserver.sh so that bit is correct.
Almost there....will keep digging ...got to be something simple

Thanks for your teaching and help.
Find all posts by this user
08-08-2009, 01:16 AM
Post: #20
RE: php exec() function and linux shell command
OK.....cracked it !!

problem was with appinfo.json file.

journey4712 had :
Code:
daemon="daemon.sh"

It should have been:

Code:
daemon_script="daemon.sh"

took a while with lots of debug statements in appinit.cgi to find why daemon.sh was not not being called.

This highlights a slight flaw in CSI in that it does not validate or enforce strict format for appinit.json file.

Also changed daemon.sh so that the SHUTDOWN.CGI is removed if STOP is ever called. New daemon.sh :

Code:
#!/bin/sh

SCRIPT="shutdown.cgi"
SOURCE=$(echo $0 | sed 's,[^/]*$,,')
DEST="/opt/sybhttpd/default"

if [ x"$1" == x"start" ]; then
   cp $SOURCE/$SCRIPT $DEST/
   chmod +x $DEST/$SCRIPT
   exit
fi

if [ x"$1" == x"stop" ]; then
   rm $DEST/$SCRIPT
fi
Find all posts by this user
08-09-2009, 06:26 PM
Post: #21
RE: php exec() function and linux shell command
(08-08-2009 01:16 AM)highonhd Wrote:  This highlights a slight flaw in CSI in that it does not validate or enforce strict format for appinit.json file.

It is not a flaw, it is by design.
The file is rather simple and good documentation is available how to create the file. Almost all items in the appinfo.json file are, and will remain optional as well as it will not give an error on (currently) unsupported items. This is done to allow future backwards and forwards compatibility.

I could on the other hand add a warning when an unsupported item has been encountered, that might help in incorrect compiled files.

Easy way of installing software on your NMT using just your mouse: NMT Community Software Installer
Visit this user's website Find all posts by this user
08-09-2009, 10:47 PM
Post: #22
RE: php exec() function and linux shell command
@highonhd

my apologies, i thought i compared the appinfo.json directly from a working application, but aparently i missed something obviousAngle

At least it gave you a chance to learn more about how the CSI works

journey4712

Automated TV Downloads | On-Demand Network Shares | Faster PHP (lighttpd+fastcgi+apc)
PCH-A100 | PCH-C200 | XBMC HTPC | Sharp Aquos 42D62U | Logitech Z-5500
Find all posts by this user
08-10-2009, 12:03 PM (This post was last modified: 08-10-2009 12:03 PM by Ger Teunis.)
Post: #23
RE: php exec() function and linux shell command
@Highonhd

Perhaps you want more background information.
More information regarding creating packages is available here:
http://nmtinstaller.com/?p=createpackage

Especially the "Creating packages using AppInit" link will be a good read for you I guess.

Easy way of installing software on your NMT using just your mouse: NMT Community Software Installer
Visit this user's website Find all posts by this user
08-10-2009, 08:16 PM (This post was last modified: 08-10-2009 08:28 PM by highonhd.)
Post: #24
RE: php exec() function and linux shell command
(08-09-2009 06:26 PM)Ger Teunis Wrote:  I could on the other hand add a warning when an unsupported item has been encountered, that might help in incorrect compiled files.

Hi Ger I understand the logic of not checking for unsupported fields. Adding a warning, IMHO, is much better suggestion. You could add a warning such as "Unsupported mandatory or optional field. Please check the exact name and change if incorrect"....or words to that effect.
Thanks
(08-09-2009 10:47 PM)journey4712 Wrote:  @highonhd

my apologies, i thought i compared the appinfo.json directly from a working application, but aparently i missed something obviousAngle

At least it gave you a chance to learn more about how the CSI works

journey4712

Hi Journey4712, no problem at all. It was worth the detour as I did learn quite a bit Wink. Many thanks for your help.

BTW, is there good guide for learning to write .cgi scripts for html output somewhere ?
I do not see onything on the wiki.
(08-10-2009 12:03 PM)Ger Teunis Wrote:  @Highonhd

Perhaps you want more background information.
More information regarding creating packages is available here:
http://nmtinstaller.com/?p=createpackage

Especially the "Creating packages using AppInit" link will be a good read for you I guess.

Thanks. I had read through that page. Feedback: I think it's worth adding an example of how to tar the package together on your PC or on your NMT (with the exact tar command line).[/u]
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Faster PHP server CSI package journey4712 174 63,986 03-30-2013 01:12 PM
Last Post: o34171@rtrtr.com
Star [Apps] Bierdopje 4 NMT PHP script SilverViper 4 1,419 11-26-2012 04:57 PM
Last Post: Djiest
  PHP Page showing PCH Stats Slevin 0 996 11-18-2011 08:57 PM
Last Post: Slevin
  how to start mono from php harrykausl 5 2,360 07-10-2011 10:01 PM
Last Post: harrykausl
  Quick command? Angelkiller 0 915 11-06-2010 09:08 AM
Last Post: Angelkiller
  Remote command through PC. cengaver83 0 1,320 08-08-2010 05:50 PM
Last Post: cengaver83
  mkvdts2ac3 (Adding AC3 track from DTS) [Linux/OSX] JakeWharton 151 84,629 04-12-2010 12:01 PM
Last Post: tonictrouble
  Re-enable the network share from command line? glorifyday 0 1,877 03-04-2010 05:06 PM
Last Post: glorifyday
  Lighttpd - 1.4.24 with PHP-5.2.11 for A110 vaidyasr 0 1,803 01-28-2010 11:26 AM
Last Post: vaidyasr
  mounting hdx shares from Linux - read only schnaaf 0 1,239 01-24-2010 01:21 PM
Last Post: schnaaf

Forum Jump: