Chinaunix首页 | 论坛 | 博客
  • 博客访问: 540768
  • 博文数量: 493
  • 博客积分: 2891
  • 博客等级: 少校
  • 技术积分: 4960
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 17:11
文章分类

全部博文(493)

文章存档

2010年(493)

分类:

2010-08-30 10:31:29

#!/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
阅读(699) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~