Shelling out and running an operating script can be harder than it looks. There are numerous considerations that have to be made, and there can be issues with security, the environment, and monitoring the job. In most cases, the shelling out process is one of just submitting blindly, and hoping it works.
The first decision is to determine whether the script should:
Run, and the database should wait for it to finish (synchronous)
Submit it, immediately return, and then forget about it (asynchronous)
Submit it, monitor its progress, and if need be, terminate the process
Synchronous is the default behavior. A script might be run to convert an audio WAV file into an MP3 file. This might take 5 minutes to complete. In this case, the calling program running in the database and doing the shell command will just wait for it to finish. If the script fails to finish or hangs, then the calling program will also hang. Steps need to be put into the...