Why not pass in an extraneous argument when you issue a command from ARD.
It's more a workflow than a system generated tag, but ARD likely sends the same command to launchd as the open -a
command would so that level of indirection means that you can't depend on the typical ppid from ps -ef
to find the process that forked a specific script.
Why not push a wrapper script to all your machines and use that wrapper script to log the arguments to console? Then ARD can call the wrapper script.
Something like a script stored in /usr/local/bin/remote
would work well:
#!/bin/bash
echo "This script was called remotely and is about to run another script."
/bin/bash $*
echo "This script has just run another script."
You can get all fancy with parsing the arguments or using logger
and/or date/time stamping or recording which computer did the sending, but this is a common way to track execution of other scripts.