-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprint.spell
More file actions
executable file
·47 lines (37 loc) · 779 Bytes
/
print.spell
File metadata and controls
executable file
·47 lines (37 loc) · 779 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
#!/bin/bash
BOLD=$(tput bold)
BLUE="\e[34m"
RESET=$(tput sgr0)
log() {
if [ -t 0 ]; then
echo -e "${BOLD}${BLUE}$1:${RESET} $2"
else
notify-send -u low "$1" "$2"
fi
}
file=$1
if [ -z "$file" ]; then
if [ -t 0 ]; then
echo "USAGE: $0 pdf-file.pdf"
else
notify-send -u critical 'missing pdf file param'
fi
exit
fi
if [[ -z "$2" ]]; then
if [ -t 0 ]; then
select q in HP-C6 HP-A4; do
queue="$q"
break
done
else
queue=HP-C6
fi
else
queue="$2"
fi
log 'sending pdf to print server' "$file"
spark rsync v "$file" argentum:/tmp/
log 'printing pdf' "$file"
spark ssh argentum -- lpr -P "$queue" "/tmp/$(basename "$file")"
log 'done printing pdf' "$file"