#!/bin/bash
# License: GPL
# (C) Peter Poeml <>
usage() {
cat >&2 <<-EOF
Usage: $(basename $0)
All other parameters are passed through to dhcpcd.
EOF
}
device=$1; shift
if [ -z "$device" ]; then
usage
exit 1
fi
tmpdir=$(mktemp -d /var/tmp/dhcpcd.XXXXXX)
trap 'rm -rf $tmpdir' EXIT
infofile=$tmpdir/dhcpcd-$device.info
dhcpcd -Td -t 10 -NYRG -L $tmpdir -c /bin/true $device "$@"
echo "crh"
test -f $tmpdir/dhcpcd-$device.pid && kill $(cat $tmpdir/dhcpcd-$device.pid)
if test -s $infofile; then
cat $infofile
exit 0
else
exit 1
fi
阅读(737) | 评论(0) | 转发(0) |