Hi, it's me again,
I'm getting ready to try your suggestion, but I've some questions I'd
like to ask first, please.
Le 22 août 06 à 18:23 Soir, Peter De Berdt a écrit:
On 22 Aug 2006, at 18:10, Arnaud Nicolet wrote:
Hi,
I've made 2 applications. The main app and a "server" app (this is
a service app which keeps running while the computer is working).
I would like to have an option, in the main app, so that it can
add the "server" app to the list of processes launched at startup
(when we see "Welcome to MacOS X").
I know I have to ask for the admin's password, that's not a problem.
Can this be done?
I haven't done it myself from a REALbasic app, but these are the
things you need to do for a startup item:
- Add a line to /etc/hostconfig like MYAPP =-YES- (you'll need
admin privileges for this)
Can I ask you what this line above does?
- Add a folder to /Library/StartupItems e.g. MyApp, look at an
existing one for chmod privileges
- In that folder add a file "StartupParameters.plist"
In that file, I've removed this key:
<key>Uses</key>
<array>
<string>Network</string>
<string>Resolver</string>
</array>
...since my app does not requires anything. Will it work anyway?
- Add a second file to the folder named after what you put in
hostconfig, it should look like this:
if [ -z $1 ] ; then
echo "Usage: $0 [start|stop|restart] "
exit 1
fi
# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1
. /etc/rc.common
SCRIPT="/shellpathtoapp"
StartService ()
{
if [ "${MYAPP:=-NO-}" = "-YES-" ] ; then
ConsoleMessage "Starting MyApp server"
$SCRIPT start > /dev/null 2>&1
fi
}
StopService ()
{
ConsoleMessage "Stopping MyApp server"
$SCRIPT stop > /dev/null 2>&1
}
RestartService ()
{
ConsoleMessage "Restarting MyApp server"
$SCRIPT restart > /dev/null 2>&1
}
if test -x $SCRIPT ; then
RunService "$1"
else
ConsoleMessage "Could not find MyApp startup script!"
fi
Ok, I believe I've got to change all MyApp occurrences with my own
app file name (as put in the hostconfig file). Right?
BTW: I'm not an advanced expert in MacOS X/Unix (as you can see...)
- Your application should listen to a start/stop/restart command.
The ones in my ServiceApplication in my RB project, right?
(I don't see the restart command in that class. Since the
documentation says that Continue/Pause events are not for MacOS X,
it's not a restart either).
Instead of doing all of this from your application, you'll be
better off creating a package that does all this. The application
to create packages is included in the Developer Tools from MacOS X.
It's a bit of a pain to get familiar with, but it will save you
more trouble than doing it from REALbasic.
Thanks. I'll try both.
(I'd like to achieve this without allowing the user to easily modify
my data before processing. It seems more securized by doing that from
RB than with a .pkg file, but, if it's really too hard, I'll do like
you suggest).
Thank you for your answer,
Arnaud
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>