Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #15992 > unrolled thread

Need scripting help with a new program start-up...

Started byjustaguy <donli@yahoo.com>
First post2011-12-02 12:06 -0800
Last post2011-12-07 14:14 -0800
Articles 8 — 4 participants

Back to article view | Back to comp.sys.mac.system


Contents

  Need scripting help with a new program start-up... justaguy <donli@yahoo.com> - 2011-12-02 12:06 -0800
    Re: Need scripting help with a new program start-up... Tim Streater <timstreater@greenbee.net> - 2011-12-02 20:35 +0000
      Re: Need scripting help with a new program start-up... justaguy <donli@yahoo.com> - 2011-12-02 13:20 -0800
    Re: Need scripting help with a new program start-up... Tom Harrington <tph@pcisys.no.spam.dammit.net> - 2011-12-02 16:55 -0700
      Re: Need scripting help with a new program start-up... Tim Streater <timstreater@greenbee.net> - 2011-12-03 00:02 +0000
      Re: Need scripting help with a new program start-up... Only Nixon could go to China Blue <chine.bleu@yahoo.com> - 2011-12-03 02:26 -0800
        Re: Need scripting help with a new program start-up... justaguy <donli@yahoo.com> - 2011-12-07 13:03 -0800
          Re: Need scripting help with a new program start-up... Only Nixon could go to China Blue <chine.bleu@yahoo.com> - 2011-12-07 14:14 -0800

#15992 — Need scripting help with a new program start-up...

Fromjustaguy <donli@yahoo.com>
Date2011-12-02 12:06 -0800
SubjectNeed scripting help with a new program start-up...
Message-ID<d83a99df-fdba-467e-8211-62827dfc074a@l24g2000yqm.googlegroups.com>
Hi,

I've posted a few questions here and have received helpful responses,
which I appreciate. To those who may not have read my questions/posts,
let me do a quick recap, I'm porting a web app to Mac OS X, and the
app would come bundled with its app server.

Here's what needs to happen:
for a starter, a zipped installer (Railo.zip)
1. download
2. unzip (instructions to zip to /Library folder)
3. click on {my_app_config_n_startup} shell script something.

My question is on the above #3, how do I make this
my_app_config_n_startup shell script something to perform the
following:
3a) append {the app server to startup programs), that is,
how to append the following line
/Library/railo/start
to the rc.common file

3b) run ./start  (it would launch the app server for the current
session)
3c) launch Safari with a URL
How to do that with the current script in question?

That's it.  Thank you very much.

[toc] | [next] | [standalone]


#15997

FromTim Streater <timstreater@greenbee.net>
Date2011-12-02 20:35 +0000
Message-ID<timstreater-2EE8CF.20351502122011@news.individual.net>
In reply to#15992
In article 
<d83a99df-fdba-467e-8211-62827dfc074a@l24g2000yqm.googlegroups.com>,
 justaguy <donli@yahoo.com> wrote:

> Hi,
> 
> I've posted a few questions here and have received helpful responses,
> which I appreciate. To those who may not have read my questions/posts,
> let me do a quick recap, I'm porting a web app to Mac OS X, and the
> app would come bundled with its app server.
> 
> Here's what needs to happen:
> for a starter, a zipped installer (Railo.zip)
> 1. download
> 2. unzip (instructions to zip to /Library folder)
> 3. click on {my_app_config_n_startup} shell script something.
> 
> My question is on the above #3, how do I make this
> my_app_config_n_startup shell script something to perform the
> following:
> 3a) append {the app server to startup programs), that is,
> how to append the following line
> /Library/railo/start
> to the rc.common file
> 
> 3b) run ./start  (it would launch the app server for the current
> session)
> 3c) launch Safari with a URL
> How to do that with the current script in question?
> 
> That's it.  Thank you very much.

Hmmm, I thought I tole you how to start Safari with a URL:

   /usr/bin/open -a Safari.app "http://www.example.com"

Stick this in the script of yor choice.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#15999

Fromjustaguy <donli@yahoo.com>
Date2011-12-02 13:20 -0800
Message-ID<46ecca0d-dea8-4594-818e-4229073881b2@f35g2000yqm.googlegroups.com>
In reply to#15997
On Dec 2, 3:35 pm, Tim Streater <timstrea...@greenbee.net> wrote:
> In article
> <d83a99df-fdba-467e-8211-62827dfc0...@l24g2000yqm.googlegroups.com>,
>
>
>
>
>
>
>
>
>
>  justaguy <do...@yahoo.com> wrote:
> > Hi,
>
> > I've posted a few questions here and have received helpful responses,
> > which I appreciate. To those who may not have read my questions/posts,
> > let me do a quick recap, I'm porting a web app to Mac OS X, and the
> > app would come bundled with its app server.
>
> > Here's what needs to happen:
> > for a starter, a zipped installer (Railo.zip)
> > 1. download
> > 2. unzip (instructions to zip to /Library folder)
> > 3. click on {my_app_config_n_startup} shell script something.
>
> > My question is on the above #3, how do I make this
> > my_app_config_n_startup shell script something to perform the
> > following:
> > 3a) append {the app server to startup programs), that is,
> > how to append the following line
> > /Library/railo/start
> > to the rc.common file
>
> > 3b) run ./start  (it would launch the app server for the current
> > session)
> > 3c) launch Safari with a URL
> > How to do that with the current script in question?
>
> > That's it.  Thank you very much.
>
> Hmmm, I thought I tole you how to start Safari with a URL:
>
>    /usr/bin/open -a Safari.app "http://www.example.com"
>
> Stick this in the script of yor choice.
>
> --
> Tim
>
> "That excessive bail ought not to be required, nor excessive fines imposed,
> nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

Yeah, I forgot, thanks for answering 3c).
Two more to go.

[toc] | [prev] | [next] | [standalone]


#16016

FromTom Harrington <tph@pcisys.no.spam.dammit.net>
Date2011-12-02 16:55 -0700
Message-ID<tph-505E01.16554502122011@localhost>
In reply to#15992
In article 
<d83a99df-fdba-467e-8211-62827dfc074a@l24g2000yqm.googlegroups.com>,
 justaguy <donli@yahoo.com> wrote:

> Hi,
> 
> I've posted a few questions here and have received helpful responses,
> which I appreciate. To those who may not have read my questions/posts,
> let me do a quick recap, I'm porting a web app to Mac OS X, and the
> app would come bundled with its app server.
> 
> Here's what needs to happen:
> for a starter, a zipped installer (Railo.zip)
> 1. download
> 2. unzip (instructions to zip to /Library folder)
> 3. click on {my_app_config_n_startup} shell script something.
> 
> My question is on the above #3, how do I make this
> my_app_config_n_startup shell script something to perform the
> following:
> 3a) append {the app server to startup programs), that is,
> how to append the following line
> /Library/railo/start
> to the rc.common file

Seriously: don't. It's much better to use launchd. In that case you just 
drop a tiny XML file in the right place and use launchctl to load it. 
Thereafter it gets loaded automatically.

> 3b) run ./start  (it would launch the app server for the current
> session)

Most likely this would be done from your launchd configuration.

> 3c) launch Safari with a URL
> How to do that with the current script in question?

"open -a Safari" works but I'd recommend dropping the app name and just 
using "open http://whatever/". That will load the URL in the user's 
preferred browser instead of forcing it to load in Safari.

-- 
Tom "Tom" Harrington
Independent Mac OS X developer since 2002
http://www.atomicbird.com/

[toc] | [prev] | [next] | [standalone]


#16017

FromTim Streater <timstreater@greenbee.net>
Date2011-12-03 00:02 +0000
Message-ID<timstreater-A526B5.00020903122011@news.individual.net>
In reply to#16016
In article <tph-505E01.16554502122011@localhost>,
 Tom Harrington <tph@pcisys.no.spam.dammit.net> wrote:

> In article 
> <d83a99df-fdba-467e-8211-62827dfc074a@l24g2000yqm.googlegroups.com>,
>  justaguy <donli@yahoo.com> wrote:
> 
> > Hi,
> > 
> > I've posted a few questions here and have received helpful responses,
> > which I appreciate. To those who may not have read my questions/posts,
> > let me do a quick recap, I'm porting a web app to Mac OS X, and the
> > app would come bundled with its app server.
> > 
> > Here's what needs to happen:
> > for a starter, a zipped installer (Railo.zip)
> > 1. download
> > 2. unzip (instructions to zip to /Library folder)
> > 3. click on {my_app_config_n_startup} shell script something.
> > 
> > My question is on the above #3, how do I make this
> > my_app_config_n_startup shell script something to perform the
> > following:
> > 3a) append {the app server to startup programs), that is,
> > how to append the following line
> > /Library/railo/start
> > to the rc.common file
> 
> Seriously: don't. It's much better to use launchd. In that case you just 
> drop a tiny XML file in the right place and use launchctl to load it. 
> Thereafter it gets loaded automatically.
> 
> > 3b) run ./start  (it would launch the app server for the current
> > session)
> 
> Most likely this would be done from your launchd configuration.
> 
> > 3c) launch Safari with a URL
> > How to do that with the current script in question?
> 
> "open -a Safari" works but I'd recommend dropping the app name and just 
> using "open http://whatever/". That will load the URL in the user's 
> preferred browser instead of forcing it to load in Safari.

Yes, this is probably better in justaguy's case. In my case I 
specifically wanted Safari to open. It's so long since I researched open 
that I forgot you could open a URL directly.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#16035

FromOnly Nixon could go to China Blue <chine.bleu@yahoo.com>
Date2011-12-03 02:26 -0800
Message-ID<chine.bleu-F913EE.02264403122011@news.eternal-september.org>
In reply to#16016
In article <tph-505E01.16554502122011@localhost>,
 Tom Harrington <tph@pcisys.no.spam.dammit.net> wrote:

> > 1. download
> > 2. unzip (instructions to zip to /Library folder)
> > 3. click on {my_app_config_n_startup} shell script something.

The developer tools (which someone likely already has to get gcc) have a tool to 
build MacOSX style installers. It would look for professional to use that.


Also there's an old unix trick called a shar which does steps 2 and 3 with one 
script file which can look something like

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#!/bin/sh
cd /Library
uudecode <<'::eof::' -p | zcat | tar xf -
    Here you copy in a uuencoded gzipped tar for the preceding command line.
    For a zip file you would use ditto (perhaps) instead zcat|tar
::eof::

    Here you copy in the contents of the script my_app_config_n_startup
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

And put in a text file with executable permission and a name like 
GiZmatic.command

The client downloads and double clicks the .command file. It will create a shell 
window, untar (or unzip) the uuencoded payload into /Library, and run the start 
up script.

-- 
White folks think they're at the top,  |        Ha, ha, that is very logical.
ask any proud white male.              |       I'm whoever you want me to be.
A million years of evolution,          |  Annoying Usenet one post at a time.
and we get Danny Quayle.               |    At least I can stay in character.

[toc] | [prev] | [next] | [standalone]


#16229

Fromjustaguy <donli@yahoo.com>
Date2011-12-07 13:03 -0800
Message-ID<3a8bed9f-0069-4cd1-8fdc-ac0ee6f7d6ba@4g2000yqu.googlegroups.com>
In reply to#16035
On Dec 3, 5:26 am, Only Nixon could go to China Blue
<chine.b...@yahoo.com> wrote:
> In article <tph-505E01.16554502122011@localhost>,
>  Tom Harrington <t...@pcisys.no.spam.dammit.net> wrote:
>
> > > 1. download
> > > 2. unzip (instructions to zip to /Library folder)
> > > 3. click on {my_app_config_n_startup} shell script something.
>
> The developer tools (which someone likely already has to get gcc) have a tool to
> build MacOSX style installers. It would look for professional to use that.
>
> Also there's an old unix trick called a shar which does steps 2 and 3 with one
> script file which can look something like
>
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> #!/bin/sh
> cd /Library
> uudecode <<'::eof::' -p | zcat | tar xf -
>     Here you copy in a uuencoded gzipped tar for the preceding command line.
>     For a zip file you would use ditto (perhaps) instead zcat|tar
> ::eof::
>
>     Here you copy in the contents of the script my_app_config_n_startup
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>
> And put in a text file with executable permission and a name like
> GiZmatic.command
>
> The client downloads and double clicks the .command file. It will create a shell
> window, untar (or unzip) the uuencoded payload into /Library, and run the start
> up script.
>
> --
> White folks think they're at the top,  |        Ha, ha, that is very logical.
> ask any proud white male.              |       I'm whoever you want me to be.
> A million years of evolution,          |  Annoying Usenet one post at a time.
> and we get Danny Quayle.               |    At least I can stay in character.

Very helpful, thank you.  Some more specific questions,
a) the files are zipped by a Mac zip program or built-in function.
Should the line
uudecode <<'::eof::' -p | zcat | tar xf -
actually reads
uudecode <<'::eof::' -p | zcat xf -
?
b) for the {my_app_config_n_startup} part,
we need to accomplish the following tasks:
b1. detect if this Mac computer has Firefox browser installed, if not,
alert ("Firefox browser is required for Knowledge NoteBook"), abort.
else continue with the following tasks:
b2. create an icon of Knowledge NoteBook (what icon format does Mac
require for it?) to launch it on the Mac, and upon launch, it opens up
Firefox browser, with URL, http://127.0.0.1:8888/knb/
b3. start the app server (a shell script)
b4. ping localhost -n 30  /* wait for 30 seconds for it to be ready */
b5. launch a URL for configuration and then the app, /* not to be
published to the public for now */
Done.

Thank you again.

[toc] | [prev] | [next] | [standalone]


#16230

FromOnly Nixon could go to China Blue <chine.bleu@yahoo.com>
Date2011-12-07 14:14 -0800
Message-ID<chine.bleu-7DE898.14142807122011@news.eternal-september.org>
In reply to#16229
In article <3a8bed9f-0069-4cd1-8fdc-ac0ee6f7d6ba@4g2000yqu.googlegroups.com>,
 justaguy <donli@yahoo.com> wrote:

> On Dec 3, 5:26 am, Only Nixon could go to China Blue
> <chine.b...@yahoo.com> wrote:
> > In article <tph-505E01.16554502122011@localhost>,
> >  Tom Harrington <t...@pcisys.no.spam.dammit.net> wrote:
> >
> > > > 1. download
> > > > 2. unzip (instructions to zip to /Library folder)
> > > > 3. click on {my_app_config_n_startup} shell script something.
> >
> > The developer tools (which someone likely already has to get gcc) have a 
> > tool to
> > build MacOSX style installers. It would look for professional to use that.
> >
> > Also there's an old unix trick called a shar which does steps 2 and 3 with 
> > one
> > script file which can look something like
> >
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > #!/bin/sh
> > cd /Library
> > uudecode <<'::eof::' -p | zcat | tar xf -
> >     Here you copy in a uuencoded gzipped tar for the preceding command 
> > line.
> >     For a zip file you would use ditto (perhaps) instead zcat|tar
> > ::eof::
> >
> >     Here you copy in the contents of the script my_app_config_n_startup
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >
> > And put in a text file with executable permission and a name like
> > GiZmatic.command
> >
> > The client downloads and double clicks the .command file. It will create a 
> > shell
> > window, untar (or unzip) the uuencoded payload into /Library, and run the 
> > start
> > up script.
> >
> > --
> > White folks think they're at the top,  |        Ha, ha, that is very 
> > logical.
> > ask any proud white male.              |       I'm whoever you want me to 
> > be.
> > A million years of evolution,          |  Annoying Usenet one post at a 
> > time.
> > and we get Danny Quayle.               |    At least I can stay in 
> > character.
> 
> Very helpful, thank you.  Some more specific questions,
> a) the files are zipped by a Mac zip program or built-in function.
> Should the line
> uudecode <<'::eof::' -p | zcat | tar xf -
> actually reads
> uudecode <<'::eof::' -p | zcat xf -

I think the ditto command is for zip files.

gzipped tars are the traditional unix alternative to zip files.

> b) for the {my_app_config_n_startup} part,

Whatever script you currently use, you can use in shar.

> we need to accomplish the following tasks:
> b1. detect if this Mac computer has Firefox browser installed, if not,
> alert ("Firefox browser is required for Knowledge NoteBook"), abort.
> else continue with the following tasks:
> b2. create an icon of Knowledge NoteBook (what icon format does Mac
> require for it?) to launch it on the Mac, and upon launch, it opens up
> Firefox browser, with URL, http://127.0.0.1:8888/knb/
> b3. start the app server (a shell script)
> b4. ping localhost -n 30  /* wait for 30 seconds for it to be ready */
> b5. launch a URL for configuration and then the app, /* not to be
> published to the public for now */
> Done.
> 
> Thank you again.

-- 
My name Indigo Montoya.      |        Ha, ha, that is very logical.
You flamed my father.        |       I'm whoever you want me to be.
Prepare to be spanked.       |  Annoying Usenet one post at a time.
Stop posting that!           |    At least I can stay in character.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.mac.system


csiph-web