Article View: comp.unix.misc
Article #2042Re: How to launch a shell script (.sh) from an HTML page ?
From: Keith Duffin
Date: Tue, 23 Oct 2001 11:49
Date: Tue, 23 Oct 2001 11:49
55 lines
3144 bytes
3144 bytes
Shell can be used out of the box by apache as a cgi. Just drop a shell
script in your cgi directory. The most common problem is the "malformed
header". Just be sure to give it a plain text header:
#!/bin/sh
echo "Content-type: text/plain\n\n"
/bin/ls
Take Care, Keith
"David Winter" <noemail@nospam.com> wrote in message
news:9r3fue$6k5$1@news.businessobjects.com...
> Hi,
>
> I'm sure somebody already posted the solution some time ago, but I
couldn't
> find it.
> I need to launch a sheel script (.sh file) from an HTML page under unix
> (Solaris and others).
> I am NOT using any server: this only a LOCAL html page. No virtual
> directories.
>
> Right now I am using the following code, that is executed from an image
> button in an HTML <form>:
>
> <script>
> function openMyFile ()
> {
> if (document.layers)
> {
> var exePath = new String('. ./test.sh');
>
> netscape.security.PrivilegeManager.enablePrivilege('UniversalExecAccess');
> java.lang.Runtime.getRuntime().exec(exePath);
> }
> }
> </script>
>
>
> The test.sh file changes the current directory in order to run another sh
> that launches a java application.
>
> I have tried several shell commands, such as:
>
> '. ./test.sh'
> './test.sh'
>
> but no luck. Nothing happens and my sh file is not launched.
> Any ideas ? Please reply in this newsgroup.
>
>
> Thank you for your help,
>
> David Winter
>
>
Technical Details
Message-ID:
<BPcB7.1463$jr.299765@news1.rdc1.va.home.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.va.home.com.POSTED!not-for-mailReferences:
<9r3fue$6k5$1@news.businessobjects.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,ce5dc68f68e2e00a X-Google-Attributes: gidf8c9b,public X-Google-Thread: fe1d2,ce5dc68f68e2e00a X-Google-Attributes: gidfe1d2,public X-Google-Thread: f72b0,ce5dc68f68e2e00a X-Google-Attributes: gidf72b0,public X-Google-Thread: 110f2c,ce5dc68f68e2e00a X-Google-Attributes: gid110f2c,public X-Google-Thread: fa664,ce5dc68f68e2e00a X-Google-Attributes: gidfa664,public X-Google-Thread: 1012a6,ce5dc68f68e2e00a X-Google-Attributes: gid1012a6,public X-Google-Thread: 11035d,ce5dc68f68e2e00a X-Google-Attributes: gid11035d,public X-Google-ArrivalTime: 2001-10-23 04:49:54 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.va.home.com.POSTED!not-for-mail From: "Keith Duffin" <keith@duffin.org> Newsgroups: comp.unix.misc,comp.unix.questions,comp.unix.sco.misc,comp.unix.sco.programmer,comp.unix.shell,comp.unix.solaris,fr.comp.os.unix References: <9r3fue$6k5$1@news.businessobjects.com> Subject: Re: How to launch a shell script (.sh) from an HTML page ? Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <BPcB7.1463$jr.299765@news1.rdc1.va.home.com> Date: Tue, 23 Oct 2001 11:49:53 GMT NNTP-Posting-Host: 24.7.186.162 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.va.home.com 1003837793 24.7.186.162 (Tue, 23 Oct 2001 04:49:53 PDT) NNTP-Posting-Date: Tue, 23 Oct 2001 04:49:53 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster