- 论坛徽章:
- 0
|
加上 Edengundam 的指点.整个脚本基本成型,凑合着能用了
配置就在楼顶的下边
- #放弃版权,随便传播,非稳定因素造成的后果自负
- #!/bin/sh
- USER=`whoami`
- . /home/$USER/.profile >/dev/null 2>&1
- getfile()
- {
- [ ${host:=x} = "x" ] && echo "host is null" && exit 0
- [ ${user:=x} = "x" ] && echo "user is null" && exit 0
- [ ${passwd:=x} = "x" ] && echo "passwd is null" && exit 0
- [ ${ftpdir:=x} = "x" ] && echo "ftpdir is null" && exit 0
- [ ${filename:=x} = "x" ] && echo "filename is null" && exit 0
- [ ${workdir:=x} = "x" ] && echo "workdir is null" && exit 0
-
- ftp -i -n -v $host <<END
- user $user $passwd
- ascii
- lcd $workdir
- cd $ftpdir
- get $filename
- by
- END
- }
- yyyymmdd=`date +%Y%m%d`
- cfgfile=/app1/_ftp.cfg
- workdir=/app1/
- for task in `grep "\[.*\]" $cfgfile | sed -n 's:[[]\([^]]*\)[]]:\1:p'`
- do
- echo $task
- for line in `sed -n "/\[$task\]/,/^$/"p $cfgfile|grep -v "\[$task\]"`
- do
- # tmpstr=`echo $line|cut -d= -f1`
- eval $line
- # eval echo \$$tmpstr
- done
- getfile
- done
复制代码 |
|