• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
2 problems.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2 problems.


  • Subject: 2 problems.
  • From: "D.Walsh" <email@hidden>
  • Date: Mon, 3 Jan 2005 00:11:47 -0500
  • Mta-interface: amavisd-new-2.2.1 (2004-12-22) at daleenterprise.com


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


  • Follow-Ups:
    • Re: 2 problems.
      • From: Steve Checkoway <email@hidden>
    • Re: 2 problems.
      • From: David Reed <email@hidden>
    • Re: 2 problems.
      • From: Dan Saul <email@hidden>
  • Prev by Date: Re: Strange Logs when playing a sound
  • Next by Date: Re: 2 problems.
  • Previous by thread: Re: Strange Logs when playing a sound
  • Next by thread: Re: 2 problems.
  • Index(es):
    • Date
    • Thread