Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 45 lines (30 sloc) 1.17 KB
#!/bin/bash
baseDirectory=`pwd`
### Specifiy new printer name and location (e.g.: "FEL/operating" belonging to the logbook "operating" in FEL project)
printerDir="/usr/local/labfolder/printers/CRYVISIL"
printerName="ComputerStuff_SW"
locationOfPrinter="${printerDir}/${printerName}"
mkdir -p ${locationOfPrinter}
### Host name and server
hostName="lf"
server="http:\/\/${hostName}.rz-berlin.mpg.de:9091"
### Adjust template lplisten.tmp
lplisten=lplisten_${printerName}
cp lplisten.tmp ${locationOfPrinter}/${lplisten}
cd ${locationOfPrinter}
pythonScript=createEntryAndAddAttachment.py
sed -i 's/@pythonScript/'${pythonScript}'/g' ${lplisten}
ln -sf ${baseDirectory}/${pythonScript} ${pythonScript}
sed -i 's/@SERVER/'${server}'/g' ${lplisten}
sed -i 's/@HOSTNAME/'${hostName}'/g' ${lplisten}
sed -i 's/@PROJECTNAME/'${printerName}'/g' ${lplisten}
sed -i 's/@USER/printer@fhi-berlin.mpg.de/g' ${lplisten}
sed -i 's/@PASSWORD/test1234/g' ${lplisten}
### Pipe
pipe=prnt
mkfifo ${pipe}
chown lp:lpadmin ${pipe} ${lplisten}
### Set up the CUPS Raw Printer
lpadmin -p ${printerName} -v file://${locationOfPrinter}/${pipe} -E
### Run the script that listens to the pipe
./${lplisten}