Re: 2 problems.
Re: 2 problems.
- Subject: Re: 2 problems.
- From: Dan Saul <email@hidden>
- Date: Sun, 2 Jan 2005 23:31:38 -0600
To find if a application is running, use -launchedApplications in NSWorkspace.
I am not too familiar with shell scripting else seems to be able to be
done with NSFileManager and NSString calling system() or popen() if
you must.
But these really are RTFM questions, take a look on
http://cocoadev.com if you need more reference tools.
On Mon, 3 Jan 2005 00:11:47 -0500, D.Walsh <email@hidden> wrote:
>
> I realize this may be newbie type questions or questions from an
> inexperienced programmer but, all that I ask is that you please stop
> laughing long enough to provide me with a useable answer that doesn't
> include RTFM or go search.
>
> problem #1
>
> I have the following shell script, valid values for VALUE are '-YES-'
> or '-NO-'
>
> #!/bin/sh
>
> NAME="MAILTRANSPORT"
> VALUE=$1
> PATTERN="^$NAME="
> HOSTCONFIG=/etc/hostconfig
>
> if [ -z $(grep "$PATTERN" $HOSTCONFIG) ]; then
> # create initial entry
> echo "$NAME=$VALUE" >> $HOSTCONFIG
> else
> # replace entry with new value
> TMP=$(mktemp /tmp/hostconfig.XXXXXX) || exit 1
> grep -v "$PATTERN" $HOSTCONFIG >> $TMP
> echo "$NAME=$VALUE" >> $TMP
>
> mv $TMP $HOSTCONFIG
> chmod 644 $HOSTCONFIG
> chown root:wheel $HOSTCONFIG
> fi
>
> I need to duplicate this process in a binary application (made in
> XCode) so I'm looking for some source code that does this, do you have
> something that can help me?
>
> problem #2
>
> How do I determine if an application/daemon is running, the app/daemon
> has a pid and a socket file, if you have some source code for this I'd
> appreciate it.
>
> -- Dale
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >2 problems. (From: "D.Walsh" <email@hidden>) |