dot dot dotfiles
1#!/usr/bin/bash
2
3NC='\033[0m'
4ARG='\033[0;31m' # red
5TXT='\033[0;32m' # green, or 1;32m for light green
6SYM='\u2192' # right arrow
7
8PRINTER='Canon'
9
10if [ "$1" == "" ] || [ "$1" == "help" ]; then
11 echo -e "${SYM} ${ARG}no arguments${NC} : ${TXT}Display these help messages.${NC}"
12 echo -e "${SYM} ${ARG}on/start${NC} : ${TXT}Turn printer services on.${NC}"
13 echo -e "${SYM} ${ARG}off/stop${NC} : ${TXT}Turn printer services off${NC}"
14 echo -e "${SYM} ${ARG}status${NC} : ${TXT}Display status of printer services${NC}"
15elif [ "$1" == "on" ] || [ "$1" == "start" ]; then
16 sudo systemctl start cups.service avahi-daemon.service
17elif [ "$1" == "off" ] || [ "$1" == "stop" ]; then
18 sudo systemctl stop cups.service avahi-daemon.service
19elif [ "$1" == "status" ]; then
20 avahi-browse --all --ignore-local --resolve --terminate | grep ${PRINTER}
21else
22 echo "Parameter not recognised; see 'printer help' for details"
23 exit 1
24fi
25
26# Printer queue manipulation:
27# lpq -a
28# lprm <Job Number>