易截截图软件、单文件、免安装、纯绿色、仅160KB

perl自动ftp的方法(Linux版本,Net::FTP)

 --这里所有的perl技术问题都是我平常处理数据的时候要用到的,可能不是很强的程序,但是希望能和热爱perl的同志,一起分享...
    在很多情况下,我们需要从远处服务器上下载当天或者昨天生成的日志文件,来查看一些我们需要的东西或者备份。
    如果采用了ftp,那么我们应该建立自动化的ftp方式,来方便我们的工作,下面我们将使用perl语言编写的,当然也可以用shell。
    利用了perl的模块:Net::FTP。
#!/usr/bin/perl
use Net::FTP;
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
$year=$year+1900;  #显示为当前年份
$mon=$mon+1;       #显示为当前月份
 $mon = "0".$mon if ($mon < 10);   #显示月份为 01,02的格式
$sum="$year-$mon-$mday";  #显示时间 为 2008-12-22 这样的格式
$ftp = Net::FTP->new("hostname(IP地址)", Debug =>1);
$ftp->login('user(用户名)','passwd(密码)');
$ftp->binary;
$ftp->cwd("path(路径)");
 $ftp->get("$sum-filename(文件名)")  #比如 2008-12-22_text.txt
      or die "$!";
$ftp->quit;
保存后。给文件加上执行。利用 chmod命令。(我们暂时把执行文件叫做 Ftp.pl)
在来设置例行性命令  利用crontab命令。
比如 你想早上5点半开始执行下载。则加入
30 05 * * *  perl Ftp.pl
保存。则程序就开始自动化ftp了。


相关文档:

Linux内存管理之slab分配器分析(续五)

 九:几点补充:
1: Slab中使用的页面都会加上“PG_slab”标志,以跟一般的页面区别。另外,在释放内存的时候,经常需要用到从页面到slab的对应转换关系。那是怎样标识的呢?
关于标志:
注意有以下代码:
static void *kmem_getpages(kmem_cache_t *cachep, int flags, int nodeid)
{
  &n ......

Linux下 c 判断一个文件是否存在

#include <stdio.h>
#include <unistd.h>
#define FOO "foo"
int main(void)
{
if(!access(FOO, F_OK))
{
if(!unlink(FOO))
{

}
else
{
printf("remove %s failed\n", FOO);
}
}
else
{
printf("%s not existed\ ......

Linux kernel development Chapter2 进程管理

1 进程管理相关代码
  1.1 thread_info结构,在文件<asm/thread_info.h>中定义
      struct thread_info {
           struct task_struct *task;
           struct exec ......

关于linux下的软链接和硬链接

 连接上了服务器,检查一下。磁盘空间不够了
[java@localhost ~]$ df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 5.8G 5.8G 0M 100% /
/dev/hda1 99M 8.5M 86M 10% /boot
none 506M 0 506M 0% /dev/shm
/dev/hda6 20G 77M 19G 1% /tmp
/dev/hda5 20G 14G 5.2G 72% /usr/local
/dev/hd ......

Linux下C语言编程基础(Makefile)

 
Linux下C语言编程基础(Makefile)
2005-01-18 10:28:23 来自:赛迪网
 
假设我们有下面这样的一个程序,源代码如下:
/* main.c */
#include "mytool1.h"
#include "mytool2.h"
int main(int argc,char **argv)
{
mytool1_print("hello");
mytool2_print(&q ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号