Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6918255
  • 博文数量: 637
  • 博客积分: 10265
  • 博客等级: 上将
  • 技术积分: 6165
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-12 22:00
文章分类

全部博文(637)

文章存档

2011年(1)

2010年(1)

2009年(3)

2008年(12)

2007年(44)

2006年(156)

2005年(419)

2004年(1)

分类:

2007-04-01 11:21:11

感觉不错,从来没有试过使用.nterc
#!/bin/bash
#
# iSight Auto Upload Script - by Dylan O'Donnell 2006
#####################################################
# Edit CAPITALS with appropriate details
# Notes : Change file path to a folder without other JPEGs
# : IF you get zero-byte files, try removing the "passive" line from the FTP stuff.
#
#####################################################

# Generate filename based on date stamp
date=$(date +%m%d%y%H%M%S).jpg;

# Take iSight Photo and store in /tmp with datestamp filename
/bin/isightcapture -w 640 -h 480 -t jpg /Users/USERACCOUNT/Documents/$date;

# Wait a little while, if Mac is waking from sleep, needs a moment to connect to network
sleep 60;

# Generate semaphore for connectivity by pinging NASA
isconnected=$(ping -c 1 | grep 64 | wc | awk '{print $1}');

# If connected...
if [ "$isconnected" -eq "1" ]; then

# Make .netrc FTP session commands on the fly
cat > ~/.netrc <<-EOF
machine
login USERNAME
password PASS
macdef init
lcd /Users/USERACCOUNT/Documents
cd REMOTE/DIR
passive
prompt
restrict
type binary
prompt
mput *.jpg
quit

EOF

# Run FTP session to put JPGs in webspace, then delete from /tmp
chmod 600 ~/.netrc
ftp -i
rm /Users/USERACCOUNT/Documents/*.jpg

else
# If not connected.. leave captures there until next time.
echo "No Connection, Image not transferred or deleted.";
fi


阅读(6588) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~