slock/slocked

25 lines
331 B
Plaintext
Raw Normal View History

2014-07-17 14:03:00 -07:00
#!/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
2014-08-05 19:09:03 -07:00
if test -z "$1"; then
exec slock -f ~/.slock_passwd
exit 1
2014-07-17 14:03:00 -07:00
fi
2014-08-05 19:09:03 -07:00
exec slock -p "$1"
exit 1