I'd like to start n threads of a script, each with their own process id.
I currently do this via cronjob like so:
* * * * *    php /path/to/script.php >> /log/script.log 2>&1
* * * * *    php /path/to/script.php >> /log/script.log 2>&1
* * * * *    php /path/to/script.php >> /log/script.log 2>&1
Each of these three threads all log to the same script.log, which pairs output with its pid.
How can I do the same without copy/paste from a script?
Would the following spawn each of these with a different pid (accessible from php's getmypid())? Or would they all share the same script-launcher.sh pid?
#!/bin/bash
# Let's call this `script-launcher.sh`
# Launch 3 threads at once with `script-launcher.sh 3`
N=${1-0}
for i in {1..$N}
do
   php /path/to/script.php >> /log/script.log 2>&1
done
 
    