• 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
Re: pid vs. Process Serial Number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pid vs. Process Serial Number


  • Subject: Re: pid vs. Process Serial Number
  • From: Tommy Nordgren <email@hidden>
  • Date: Thu, 21 Sep 2006 21:27:47 +0200


On 21 sep 2006, at 13.34, Brad Peterson wrote:

Hi all,

I'm trying to determine if my app was launched by cron
so that I can automate certain actions which would
otherwise require interaction.

So, I figured I'd use getppid(), convert the result to
a psn, use that to get the process' name, and then
check for "cron".

But, I always get a -600 when calling
GetProcessForPID().

Has anyone used this successfully? Alternatively, can
anyone suggest a different approach which might work
better?

Thanks!  (Code below)

B

I don't think BSD subsystem apps have Process Serial Numbers.
Try getting the parent process ID and check it against a pipe connected
to the ps command line app.
This will work, and will be reasonably efficient, since the check only needs
to be done at startup.
Another option is to ASSUME you are being called from cron,
and set up your GUI in the first Apple Event received
-------------------------------------
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
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


  • Follow-Ups:
    • Re: Re: pid vs. Process Serial Number
      • From: "Tom Harrington" <email@hidden>
References: 
 >pid vs. Process Serial Number (From: Brad Peterson <email@hidden>)

  • Prev by Date: Bind checkbox in menu?
  • Next by Date: Connect to two network interfaces simultaneously?
  • Previous by thread: Re: pid vs. Process Serial Number
  • Next by thread: Re: Re: pid vs. Process Serial Number
  • Index(es):
    • Date
    • Thread