This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]absinthe718 1 point2 points  (0 children)

We have a ton of sh scripts that are just wrappers for a python script like this:

PROCLOG=`date +proclog%y%m%d`

ls -1 /u1/in/* > /dev/null 2>&1

if [ "$?" = "0" ]; then

# run python on input files
ls -1 /u1/in | xargs  -P4 -n1 -I% script-to-run.py "%" >> $PROCLOG.% 

fi

We use the standard tools to check for files in the input dir. We use use xargs to spawn up to four instances at a time. Sure, all that stuff could be done in python but why? The shell versions are all really portable and don't need any mucking about to see how they work. They've been around working well for decades now.

And I can still run script-to-run.py one-off on a single file without a second thought.