I am not using my printer everyday, so why should I keep the CUPS print daemon started all the time? I think a better way is to start it only when you need it (preferable before you have to print, otherwise your printer will not show up or you could not communicate with it).
The memory footprint is not so high, but anyway, why should I consume 3MB of physical RAM or 40MB of virtual RAM if I don't have to? You know, little bit from here, little bit from there, shortly you will find that many applets/plugins/daemons you might have started by default (eg: at session start-up) will eat few hundreds MB of RAM.
My solution is quite simple:
- write a simple bash script (eg: printer) that will switch the CUPS daemon status (from started -> stopped and vice versa)
- define a desktop keyboard shortcut (eg: Ctrl+Alt+P) that will launch that bash script
- push Ctrl+Alt+P to start CUPS daemon or again, when you want to stop/unload it
The bash script:
#!/bin/bash CUPS=/etc/init.d/cupsd STATUS=$(${CUPS} status|awk '/status:/ {print $NF}') PROMPT="To start/stop CUPS daemon you must provide sudo password" if [ "$STATUS" != "started" ];then gksu -m "$PROMPT" ${CUPS} start MSG="started" ICON="devices/printer.png" DEFAULT_PRN=$(lpstat -d|awk '{print $NF}') else DEFAULT_PRN=$(lpstat -d|awk '{print $NF}') gksu -m "$PROMPT" ${CUPS} stop MSG="stopped" ICON="status/printer-error.png" fi /usr/bin/notify-send -i "/usr/share/icons/Tango/48x48/$ICON" "Printer $DEFAULT_PRN" "CUPS has been $MSG"
Note: Don't forget to set the script as executable (chmod +x printer)
Because we involve also little bit the libnotify library we will get also a wonderful balloon that will display the status:
Important: the icon shown above comes from my Xfce icon theme (Tango) so you might have to change the icon path in the script to fit your system configuration.
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Eugen Mihailescu
Latest posts by Eugen Mihailescu (see all)
- Dual monitor setup in Xfce - January 9, 2019
- Gentoo AMD Ryzen stabilizator - April 29, 2018
- Symfony Compile Error Failed opening required Proxies - January 22, 2018