Skip to content

Instantly share code, notes, and snippets.

@ozgurakgun
Last active February 28, 2018 09:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozgurakgun/4493366 to your computer and use it in GitHub Desktop.
Save ozgurakgun/4493366 to your computer and use it in GitHub Desktop.
#!/bin/bash
num=4 # num is number of cores
qFile='path/to/your/queue.file' # this is the queue file
on_die()
{
echo "Stopping..."
rm $qFile
exit 0
}
trap 'on_die' SIGHUP SIGINT SIGTERM
if [ -f $qFile ];
then
echo "Sorry, something went wrong."
echo "Remove $qFile and try again."
else
echo "You can now submit jobs"
echo " Usage: echo ' do_this ' >> $qFile'"
touch $qFile
(
for i in `seq 1 $num` # submit a few 'auxiliary' jobs
do
echo " true " >> $qFile
done
)
tail -f $qFile | parallel -u
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment