-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleQueue.sh
More file actions
executable file
·49 lines (38 loc) · 896 Bytes
/
simpleQueue.sh
File metadata and controls
executable file
·49 lines (38 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#This is to let me run various programs, sequentally, by simply adding them to a queue.
QUEUE="/tmp/myque"
#This is the server.
QServer(){
cd /tmp
qi=0;
while true ; do
if [ -e $QUEUE ] && [ -s $QUEUE ] ; then
echo $(head -n 1 $QUEUE) 2>&1 | tee queue_$qi.log
eval $(head -n 1 $QUEUE) 2>&1 | tee -a queue_$qi.log
tail -n +2 $QUEUE > $QUEUE.tmp
mv $QUEUE.tmp $QUEUE
let qi++
else
sleep 5;
fi
if [ -e $QUEUE.add ]; then
mv $QUEUE.add $QUEUE.tmp
cat $QUEUE.tmp >> $QUEUE
rm $QUEUE.tmp
fi
done > /tmp/queue.log
}
#Add to queue
QAdd(){
echo " cd \"`pwd`\" ; $@" >> $QUEUE.add
}
#AdvQueAdd
#Makes a clone of the filesystem at QAddAdv() time, and then runs it from that state.
#Then copys it back in-to the current filesystem.
QAddAdv(){
echo "TODO."
}
#Remove from queue
#QRem(){
#
#}