Am Mittwoch, 14. Juni 2006 20:49 schrieb A.J. Venter:
> > What does that string do.  On SUSE 10.0  it reports very little.
> > root=/dev/hda2 vga=0x317 selinux=0    resume=/dev/hda1 
> > splash=silent
>
> Did you type it LITERALLY ?
> I think you were meant to expand $PID with something real (in lazarus
> code you can get what it should be for this purpose from the GetPID
> function).

indeed, if you try this literally, $PID is empty, so you get /proc/
cmdline, which is the kernel boot parameter string. 

In context of the original post and the one I replied to, you should 
replace $PID to the PID you saved in the lock file 
(typically in /var/lock) 

so in steps:
- on program start, check if a file named "/var/lock/name-off-your-app" 
exists.
  - if not: create it and write the value IntToStr(GetProcessID) into it
  - if yes: begin
        - open that file and read the pid from there into a string
          variable (e.g. suspiciousPID)
        - read file '/proc/'+suspiciousPID+'/cmdline' and check if your 
          appname is in there
          - if yes: app allready running, halt(1)
          - if not: the lock file is left from a previous, but not longer 
            active session. you may replace it with a new one containing 
            your current pid

        
> Try this:
> PID=`OS aux | grep bash | awk '{print $2} |tail -n 1`
> Then run the same command again

(try 
PID=`pidof bash | awk '{ print $1 }'`
cat /proc/$PID/cmdline
)

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to