code: public function lock()
  	{
  		$lock_file = $this->getLockFile();
  
  		if (file_exists($lock_file)) {
  			// Is running?
  			$this->pid = file_get_contents($lock_file);
  			if ($this->isrunning()) {
  				error_log("==".$this->pid."== Already in progress...");
  				return false;
  			} else
  				error_log("==".$this->pid."== Previous job died abruptly...");
  		}
  
  		$this->pid = getmypid();
  		$s = file_put_contents($lock_file, $this->pid);
  		error_log("==".$this->pid."== Lock acquired, processing the job...");
  		return $this->pid;
  	}
docs: Create a lock for this process
  
  @return int