print-remote: import
This commit is contained in:
18
print-remote/print.sh
Normal file
18
print-remote/print.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
printer=OfficeJet
|
||||||
|
proxy=zaatar
|
||||||
|
|
||||||
|
remote_temporary_directory=$(ssh "$proxy" 'mktemp -d')
|
||||||
|
clean() {
|
||||||
|
ssh "$proxy" "rm -rf $remote_temporary_directory"
|
||||||
|
}
|
||||||
|
trap clean EXIT
|
||||||
|
|
||||||
|
for file in $@; do
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
rsync "$file" "$proxy:$remote_temporary_directory"
|
||||||
|
ssh "$proxy" lpr -P "$printer" "$remote_temporary_directory/$(basename "$file")"
|
||||||
|
else
|
||||||
|
echo Skipping non-file "$file" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ssh "$proxy" lpq -P "$printer"
|
||||||
Reference in New Issue
Block a user