现在的位置: 首页 > 综合 > 正文

笔记081106 UNIX FTP CRONTAB setenv EDITOR = vi export EDITOR = vi BANNER

2017年11月10日 ⁄ 综合 ⁄ 共 4871字 ⁄ 字号 评论关闭

笔记081106


2008-11-8 上午6:22 发布人 tiger chang

 [更新时间:2008-11-8 上午7:41]

*************************************************
*    NAME    :ChangTiger                             *
*    DATE    :19:28 2008-11-6                     *
*    ADDR    :o52tiger@yahoo.com.cn       *
*************************************************

 vi ftp.sh
#!/bin/bash     -------------这里是标准格式,不可以乱改的!!!!!!!!
ftp -n <<!        ------------ 链接到ftp服务器 所需的命令都放在!!之间
open 192.168.4.40       ----------------链接到192.168.4.40 ftp服务器上
user openlab open123   --------------用户名和密码。
prompt                             -------------------关闭下载提示
cd unix_xiao                    --------------------转换到ftp服务器上的unix_xiao文件夹下
mget *.txt                         --------------------下载所有的txt文件
mget *.cpp                       --------------------下载所有的cpp文件
prompt                             --------------------开启提示
bye                                  --------------------关闭连接
!

---
********************************************************
上面shell文件解释:用ftp命令的-n参数可以从下面的文本内容中读取要执行的命令
按照顺序执行,这些命令必须放在!!之间
********************************************************

crontab command

About crontab

List of files that you want to
run on a regular schedule.

Syntax

crontab [-e] [-l] [-r]
[filename]

-e edit
a copy of the current user's crontab file, or creates an empty file to
edit if crontab does not exist. When editing is complete, the file is
installed as the user's crontab file. If a user- name is given, the
specified user's crontab file is edited, rather than the current user's
crontab file; this may only be done by a super-user. The environment
variable EDITOR determines which editor is invoked with the -e option.
The default editor is ed.
Note that all crontab jobs should be submitted using crontab ; you
should not add jobs by just editing the crontab file because cron will
not be aware of changes made this way.
-l list
the crontab file for the invoking user. Only a super-user can specify a
username following the -r or -l options to remove or list the crontab
file of the specified user.
-r remove a user's crontab from the crontab
filename The filename that contains the commands to run.

Lines that can be in the crontab file.

minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).

Examples

crontab
-e =
edits the crontab file to be used.

0 12 14 2 * mailx john%Happy Birthday!%Time for lunch.

Below is a table that represents what each of the
above fields are for.

min hour dayofmonth monthofyear dayofweek command
0 12 14 2 * mailx john%Happy Birthday!%Time for lunch.

 

Options Explanation
* Is treated as a wild
card
. Meaning any possible value.
*/5 Is treated as ever 5 minutes,
hours, days, or months. Replacing the 5 with another
numerical value will change this option.
2,4,6 Treated as an OR, so if
placed in the hours, this could mean at 2, 4, or 6
o-clock.
9-17 Treats for any value between
9 and 17. So if placed in day of month this would be days 9
through 17. Or if put in hours it would be between 9 and 5.

If you wish to create a task to be performed once
later during the day you may wish to consider using the at
command
.

Related commands

at

********************************************************
mis% setenv EDITFOR vi       ----------------------设置crontab的编辑为vi
mis% cat date.sh    
date >> date.txt
mis% crontab -l
* * * * * date.sh

********************************************************

1. vi a.sh 其中"#!/bin/sh"说明用哪种shell解释这个文件。

     chmod +x a.sh 将a.sh权限设为可执行文件。

2.
定时器contab命令

           crontab是一个很方便的在unix/linux系统上定时(循环)执行某个任务的程序

            基本用法: 1.
crontab -l 列出当前的crontab任务

             2. crontab -d 删除当前的crontab任务

            3. crontab -e
(solaris5.8上面是 crontab -r) 编辑一个crontab任务,ctrl_D结束

            4. crontab filename
以filename做为crontab的任务列表文件并载入 crontab file的格式: crontab 文件中的行由 6
个字段组成,不同字段间用空格或 tab 键分隔。

            前5 个字段指定命令要运行的时间 分钟 (0-59) 小时 (0-23) 日期 (1-31)
月份 (1-12) 星期几(0-6,其中 0 代表星期日) 第 6 个字段是一个要在适当时间执行的字符串

                     例子: #MIN HOUR DAY
MONTH DAYOFWEEK COMMAND #每天早上6点10分 10 6 * * * date #每两个小时 0 */2 * * *
date (solaris 5.8似乎不支持此种写法) #晚上11点到早上8点之间每两个小时,早上8点 0 23-7/2,8 * * *
date #每个月的4号和每个礼拜的礼拜一到礼拜三的早上11点 0 11 4 * mon-wed date #1月份日早上4点 0 4 1
jan * date


1.可以修改
setenv EDITOR=vi (cshell)
export EDITOR=vi (bash)

2. 也可以crontab 直接加文件名。

crontab l > mycronfile
编辑mycronfile
crontab mycronfile

********************************************************
banner command
********************************************************
% man banner
Reformatting page.  Please Wait... done

User Commands                                           banner(1)

NAME
     banner - make posters

SYNOPSIS
     banner strings

DESCRIPTION
     banner prints its arguments (each up to 10 characters  long)
     in large letters on the standard output.

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWesu                     |
    |_____________________________|_____________________________|

SEE ALSO
     echo(1), attributes(5)

SunOS 5.8           Last change: 14 Sep 1992                    1

********************************************************
openlab.tarena.ca% banner go

  ####     ####
 #     #    #        #
 #           #        #
 #  ###  #       #
 #    #     #        #
  ####     ####

********************************************************

抱歉!评论已关闭.