slock/slocked
Christopher Jeffrey 80bd1e8cf0 ignore newlines.
2014-08-05 18:57:06 -07:00

22 lines
317 B
Bash
Executable File

#!/bin/bash
ps=$(ps ux \
| sed 1d \
| grep -v tty1 \
| grep -v pts \
| grep -v '?' \
| awk '{ print $2 }')
if test -n "$ps"; then
echo "Killing: $ps"
kill $ps 2> /dev/null
kill -9 $ps 2> /dev/null
fi
exec 2> /dev/null
pw=$1
if test -z "$pw"; then
pw=$(cat ~/.slock_passwd)
fi
exec slock -p "$pw"