ciphermethod.com

20131119: qpurge.sh

by on Nov.19, 2013, under Linux, Scripts

DO NOT USE: Use 20140218: qpurge.sh

#!/bin/bash

# Created 20131119 by Jamey Hopkins
# Cancel all jobs older than X days
# Example: qpurge 0 will cancel jobs not created on current day

if [ “$1” = “” ]; then
echo Enter days to cancel.
echo Example: qpurge 1
exit
fi

if [ `id -un` != “root” ]; then
echo “Need to be root.”
exit
fi

X=$1

echo “Total Jobs Before: `lpstat -o | wc -l`”

find /var/spool/cups/c* -daystart -mtime +$X >qpurge.tmp 2>/dev/null
for FILE in `cat qpurge.tmp`
do
basename $FILE | sed ‘s/c//g’ | xargs cancel
done

echo “Total Jobs After: `lpstat -o | wc -l`”

rm qpurge.tmp

Leave a Comment more...


Find Files From A Specific Year

by on Nov.07, 2013, under Linux

Find files that were last modified in 2010:
ls -la | awk ‘{ if ( $8==2010) printf $9″\n” }’

Example:
$ ls -la | awk ‘{ if ( $8==2010) printf $9″\n” }’
./acr469.dat.19225756.processed

$ ls -la ./acr469.dat.19225756.processed
-rw-rw-r– 1 owner group 44280 Dec 31 2010 ./acr469.dat.19225756.processed

Leave a Comment more...

Mac Won’t Sleep

by on Oct.20, 2013, under Apple

Find out what is preventing your Mac from going into sleep mode by running the pmset -g assertions command. In the example below, the PreventUserIdleSystemSleep is set to 1, which means the system is being kept from going into sleep mode. The com.apple.ppp.pptp and com.apple.ppp.l2tp are the process that are preventing the system from sleeping. Disabling the VPN server allowed the system to sleep.

echelon:~ dervish$ pmset -g assertions
10/20/13 8:32:17 AM MST
Assertion status system-wide:
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
PreventUserIdleSystemSleep 1
InternalPreventDisplaySleep 0
ExternalMedia 1
DisableLowPowerBatteryWarnings 0
UserIsActive 0
ApplePushServiceTask 0
BackgroundTask 0

Listed by owning process:
pid 36(powerd): [0x0000000900000249] 17:13:31 ExternalMedia named: “com.apple.powermanagement.externalmediamounted”
pid 67(com.apple.serve): [0x0000000100000137] 25:56:48 PreventUserIdleSystemSleep named: “com.apple.ppp.pptp”
pid 67(com.apple.serve): [0x0000000100000136] 25:56:48 PreventUserIdleSystemSleep named: “com.apple.ppp.l2tp”
pid 8690(httpd): [0x00000001000006dc] 11:54:12 PreventUserIdleSystemSleep named: “com.apple.apache.denysystemsleep”

Leave a Comment more...

Information Technology is…

by on Oct.12, 2013, under Gazelles

Information Technology is 50% science, 25% superstition, and 25% black magic.

Leave a Comment more...


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

But Wait, There's More!

A few highly recommended friends...