This is a simple shell script I wrote a long time ago which is invoked by a CGI script on a local web page and notices files that show up in a queue directory. #!/bin/bash # This script is started by the setuid program start-queue so that the # CGI script which makes queue entries can have the queue processed # as the right user. # If the script detects a copy of itself already running, it exits and # allows the existing copy to process the new queue entries when it gets # around to it. mydir=`dirname $0` PATH=`$mydir/echo-path` export PATH cd $mydir/../queue if [ -f ".pid" ] then exit 0 fi echo $$ > .pid mypid=`cat .pid` if [ "$$" = "$mypid" ] then # Looks like this instance got here first, start processing the queue trap "rm -f .pid" EXIT while true do nextqueue=`ls -1 2>/dev/null | head -1` if [ -f "$nextqueue" ] then handle-queue-entry "$nextqueue" rm -f "$nextqueue" else # We seem to have run out of queue entries to process. Exit now. exit 0 fi done fi _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure