Sponsored Content
Full Discussion: automate an ftp job
Top Forums UNIX for Dummies Questions & Answers automate an ftp job Post 25018 by Perderabo on Tuesday 23rd of July 2002 03:01:12 PM
Old 07-23-2002
By searching this site for "automated ftp jobs", I found this old post of mine. You simply need to replace the "print -p put tar.gz" line with:
print -p get \'111.111.111.111\'
print -p get \'222.222.222.222\'

I created two files with those names and just ran the script. It worked.
 

10 More Discussions You Might Find Interesting

1. Answers to Frequently Asked Questions

Automate FTP / Scripting FTP Transfers

One of our most frequent questions is how to automate ftp transfers. There are several approaches. Since I'm writing this post, we will start with my favorite technique. :) In Automated FTP task I present a simple example of my ksh co-process technique. And note that later in this thread I... (0 Replies)
Discussion started by: Perderabo
0 Replies

2. UNIX for Advanced & Expert Users

Automate FTP

Hi all, I got this piece of code in this forum and I can't seem to get it work. The thread already closed so I just post a new thread. #!/usr/bin/ksh ftp -v -n "YOUR.IP.ADD.RESS" << cmd user "user" "passwd" cd /distant/directory lcd /local/directoryget ssh_install get ( or put) your... (4 Replies)
Discussion started by: CamTu
4 Replies

3. Shell Programming and Scripting

How to automate an FTP process?

Hello script experts, I am newbie to shell script. But I have to write a shell script (ASAP) where I need to ftp a file on daily basis to a remote server, and send an email with final status. I I should have a properties file with hostname, Userid, and pwd. And a shall script file should read... (1 Reply)
Discussion started by: ksak
1 Replies

4. Shell Programming and Scripting

Automate FTP

Hi, Currently, i am using sftp manully to transfer files between two secure servers. Can anyone provide me a sample shell script which can automate the sftp process? (11 Replies)
Discussion started by: borncrazy
11 Replies

5. Shell Programming and Scripting

Automate daily FTP files

How to automate FTP files daily with the following constraints 1) Try (every 15 mins or 30 mins) FTP till it reconnects 2) Files that arrive in between 5:30 pm and 2:00 am 3) The sat and sun, mon files are to be FTP on monday. 4) Only the txt files are to be FTP'ed. The following are the... (2 Replies)
Discussion started by: bobbygsk
2 Replies

6. IP Networking

Automate FTP process and autorestart on link failure

Hi Guys, i have this lil challenge; i am to implement an automated script that searches/scans a directory for files then picks and sends this files to a very remote server via an ftp link. the challenge here is that the ftp link fails due to netwrk issues maybe; i therefore need to develop... (5 Replies)
Discussion started by: sdcoms
5 Replies

7. Shell Programming and Scripting

How to automate ftp in perl

My situations is I cannot use NET::ftp. So I need to have a way to automate ftp. I know how to do it in ksh: #!/usr/bin/ksh ftp -i -v -n $host_name <<_FTP >> $log_file 2>&1 user $user_name lcd $local_dir cd $remote_dir put $file_name bye _FTP But how can I do it in perl? Note:... (6 Replies)
Discussion started by: egyfan
6 Replies

8. UNIX for Advanced & Expert Users

TO Automate the FTP process

Plzz Some One Help in this matter I have scripts to load the data into tables and to copy files from ftp to our system. we use to run the scripts every day.... we hav the files in the FTP server and we hav to bring the files to our system and we hav to load the data into the tables. We... (0 Replies)
Discussion started by: nani1984
0 Replies

9. Shell Programming and Scripting

Automate Job monitoring

Hi, I have a project which i need to automate some manual work. We have a 100 jobs in Linux and Unix environment. We do job monitoring daily. that is taking more that 2 to 3 hrs for us because we use autorep -j <jobname> command for each and every job. That takes more time for us to do. We have... (16 Replies)
Discussion started by: cg_saran
16 Replies

10. Shell Programming and Scripting

Automate [ls]ftp

Heyas Seen some of the ftp posts here and knowing i'll be writing a script using ftp soon, so i thought i'd write a script to automate, or at least simplify some basic tasks with it. I'm currently stuck at handling active/passiv modes. Neither lftp nor sftp seem to support them by arguments,... (3 Replies)
Discussion started by: sea
3 Replies
sysman_cli(8)						      System Manager's Manual						     sysman_cli(8)

NAME
sysman -cli - Command line interface to SysMan system management data. SYNOPSIS
/usr/sbin/sysman -cli /usr/sbin/sysman -cli -help /usr/sbin/sysman -cli -noverbose /usr/sbin/sysman -cli -focus {member_hostname} /usr/sbin/sysman -cli -list {list_options} /usr/sbin/sysman -cli -set {set_options} /usr/sbin/sysman -cli -add {add_options} /usr/sbin/sysman -cli -delete {delete_options} /usr/sbin/sysman -cli -cdf { save | validate | apply } OPTIONS
The following options are processed by sysman -cli: The default mode of output is verbose. If the -noverbose argument is passed, only essential or explicitly requested output is displayed. The -noverbose option may be used with all other options. In a cluster, this option enables you to specify which member of the cluster should be the target of an operation. Specify the host name of the cluster member as an argument to this option. This option will list all known components of the SysMan data hierarchy. If the MCLDIR environment variable is defined, it looks for component MCLs there, otherwise it finds MCLs in /usr/share/sysman/mcl. This option will list the groups that are defined for the given component. You must supply a valid component name (see -list components). This option will list the attribute names for each group in the given component. If a group is specified, it will list the attribute names for the specified group only. This option will produce an SNMP MIB (Management Information Base) definition for the given component. The MIB is written to standard output. This option will show the default attribute values for the given component and group. Default values are used when adding new rows to table type groups. If an attribute does not have a default value, an empty string is printed. List the class names for each group in the given component. If the group is specified, list the class name for the specified group only. This will list the attribute names which define the key(s) for each group in the given component. If the group is specified, it will list the key attribute names for the specified group only. If a group has no keys (for example, if it is not a table), then NONE is printed for the key attribute names. At most, two keys will be defined for a group. Options: -list types -comp comp [-group grp -attr attr1[,attr2...attrN]]] List the attribute types for each group in the given component. If the group is specified, list the attribute types for the speci- fied group only. If individual attributes are specified, list the attribute type for the given attributes. Options: -list access -comp comp [-group grp [-attr attr1 [,attr2,...attrN ]]] List the attribute access type for each group in the given component. If the group is specified, list the attribute access type for the given group only. If individual attributes are specified, list the access type for the given attributes. Access types indicate whether the attribute is READ-ONLY or READ-WRITE (with appropriate permissions). Options: -list description -comp comp [-group grp [-attr attr1[,attr2,...attrN]]] List the description of the given component. If the group is specified (with no attributes), then the description of the group is printed. If individual attributes are specified, then the description of the attributes are printed. If the MCL definition does not contain the requested description, the following string is displayed: Message catalog for path_name. This message indicates that no description is available. Options: -list values -comp comp -group grp [-attr attr1 [,attr2,...attrN ]] [-key1 k1 ] [-key2 k2]] List the attribute values for the given component and group. If attribute names are also supplied, then the value for only those attributes is displayed. If the group is a table (for example, if it has key attributes), you may supply the necessary keys to identify the correct row. If you do not supply the keys while listing attribute values, and the target is a table, all the rows in the table are listed in the output. Options: -set values -comp comp -group grp -attr attr1=newvalue[,attr2[=newvalue],... attrN[=newvalue]] [-key1k1 [-key2 ,k2]] Modify the attribute values for the given component, group and attributes. If the group is a table (for example, it has one or two keys), you may supply the necessary keys to identify the correct row. If you do not supply the necessary keys, the sysman -cli com- mand will prompt you for them (by name) at the command line. When prompted for a key attribute value, you must enter a value. For each attribute specified, you may also supply the new value for the attribute on the command line. Supply the new value by adding the = character followed by the new value. If the new value contains spaces, you must quote it, For example: -attr com- ment="This is a new comment". If you do not specify a new value for a specified attribute, the sysman -cli command will prompt you at the command line for each attribute that you did not specify a new value. When prompted, it will show you the current value of the attribute and allow you to change the attribute or keep the current value. If you do not supply any attribute names on the command line, the sysman -cli will prompt you for each attribute. For each attribute, it will show you the current value of the attribute and allow you to change the attribute or keep the current value. Options: -delete row -comp comp -group grp [-key1 k1 [-key2 k2]] Delete a row of data for the given component group and keys. If the group is NOT a table (for example, if it has no keys), data in the group cannot be deleted. You may supply the necessary keys on the command line to identify the correct row. If you do not supply the keys, the sysman -cli command will prompt you for them (by name) at the command line. Options: -add row -comp comp -group grp [-data "{attr1val} {attr2val} ... {attrNval}]" Add a row of data for the given component group and keys. If the group is NOT a table (for example, if it has no keys), data in the group cannot be added. You must use the -set values option. You may supply the necessary data for the new row via the -data option. If you do so, you must supply the value for all attributes in the correct order (see -list attributes). If you do not supply the necessary data via the -data option, the sysman -cli command will prompt you for each attribute (by name) at the command line. Options: -cdf save -comp comp -file filename [-cdfgroups {ALL | groups}]" Create a configuration definition file for the specified component and store it in the named file. You can specify individual groups or save ALL groups in a given component. See the EXAMPLES section. Validates (checks) the named cdf file for consistency. Applies the named configuration definition file to the component identified in the file. OPERANDS
-list -comp comp -comp comp -comp comp [-file filename] -comp comp -group grp -comp comp [-group grp] -comp comp [-group grp] -comp comp [-group grp] -comp comp [-group grp [-attr attr1[,attr2,...attrN]]] -comp comp [-group grp [-attr attr1[,attr2,...attrN]]] -comp comp [-group grp [-attr attr1[,attr2,...attrN]]] -comp comp -group grp [-attr attr1[,attr2,...attrN]] [-key1 k1 [-key2 k2]] -set -comp comp -group grp [-attr attr1[=newval],attr2=[newval],... ...attrN=[newval]] [-key1 k1 [-key2 k2]] -delete -comp comp -group grp [-key1 k1 [-key2 k2]] -add -comp comp -group grp [-data "{attr1val} {attr2val} ... {attrNval}"] -cdf -comp comp -file filename [-cdfgroups {ALL | groups}] -file filename -file filename DESCRIPTION
The sysman -cli command provides a generic command line interface to System Management (SysMan) data. The SysMan data is defined as that which is used to configure a system, or perform management tasks such as configuring the network. The sysman -cli command can be used to view or modify SysMan data. It can also be used to view dictionary type information such as data descriptions, key information, and type information of the SysMan data. The SysMan data is hierarchical in nature and is broken down as follows: The broadest SysMan data item is the component. A component covers all data functionality for a specific SysMan task. For example the component networkedSystems covers data relating to many aspects of configuring the network. Within a component, there may be one or more groups. Each group item deals with one aspect of the component such as the hostMappings group of the networkedSystems component. Each group is made of one or more attributes. An attribute corresponds to a data item of the group such as the aliases, networkAddress, or systemName, attribute of the hostMappings group. The following example commands show how you can display the hierarchy of attribute, group and component: # sysman -cli -list components . . networkServices networkedSystems networks nfs_export . . # sysman -cli -list groups -comp networkedSystems Component: networkedSystems Group(s): hostEquivalencies hostEquivFileText hostFileText hostMappings joinMappingService componentid digitalmanagementmodes # sysman -cli -list attributes -comp networkedSystems -group hostMappings Group: hostMappings Attribute(s): aliases comment networkAddress systemName The first command provides a list of all components on the system (truncated in this example). The second command returns all the groups for the component networkedSystems. The third command returns all the attributes for the group hostMappings. Within a group, one or two attributes may be identified as KEY attributes. This designation indicates that the group is a table, possibly containing multiple rows of data. These KEY attributes allow specific data to be uniquely identified among similar data entries. An example group which is a table is the hostMappings group of the networkedSystems component. This group is associated with the /etc/hosts file and contains one row of data for each non-comment line in the /etc/hosts file. The following example shows how you identify key attributes. # sysman -cli -list keys -comp networkedSystems -group hostMappings Component: networkedSystems Group: hostMappings Keys: systemName,networkAddress The key attributes in this group are systemName and networkAddress. These attributes are used to uniquely reference a row in the /etc/hosts file. The -list keys option can be used to identify the key attributes for any group. An example group which is not a table is the client group of the nfsconfig component. This group identifies how (or if) the system is con- figured as an NFS client. Since there is only one NFS client definition, the group is not a table. The SysMan data hierarchy is represented in files called MCLs. The name MCL stands for MIF Command Language. An MCL is an ASCII (text) file with TCL origins, which contains the hierarchical representation of a component (one component per MCL) and the TCL code required to manage the data. The MCL files are located in the /usr/share/sysman/mcl directory. The MCLDIR environment variable can be used to refer- ence a different directory, if appropriate. EXIT STATUS
The sysman -cli command utilizes the following exit codes: Success. An error occurred. ERRORS
The following errors may be returned by sysman -cli: SYSMAN_INVALID_COMPONENT Explanation: The component name specified is incorrect. Use the -list components option to view component names. SYSMAN_INVALID_GROUP Explanation: The group name specified is incorrect. Use the -list groups option with a valid component name to view group names. SYSMAN_INVALID_ATTRIBUTE Explanation: The attribute name specified is incorrect. Use the -list attributes option with a valid component and group name to view attribute names. SYSMAN_INVALID_ARGUMENT Explanation: An invalid argument to an option was given. Use the -help option to view valid option arguments . SYSMAN_MUST_SUPPLY_COMPONENT Explanation: A component name (via the -comp option) is required. Enter a valid component name. SYSMAN_MUST_SUPPLY_GROUP Explanation: A group name (via the -group option) is required. Enter a valid group name. SYSMAN_MUST_SUPPLY_ATTRIBUTE Explanation: An attribute name (via the -attr option) is required. Enter a valid attribute name. SYSMAN_INVALID_FLAG Explanation: An invalid option was given. Use the -help option to view valid options. SYSMAN_NO_DATA Explanation: No row could be found with the given keys. SYSMAN_VALIDATE_ERROR Explanation: A validation error for a set value, add row or delete row was found. The value entered for the attribute is invalid. EXAMPLES
Note See the code examples in /usr/examples/systems_management/sysman_cli for information on using sysman -cli within shell scripts. In the following examples, the format of some output has been modified to fit on the printed page. It may appear differently on the screen. A backslash () indicates that text which appears on a single line on the screen has a line break inserted in the printed example. The following example will list the known components. The list is truncated in this example: # sysman -cli -list components Component(s): account_management atm auditconfig bindconfig bttape ciconfig . . . The second version of this command shows the -list components option used on a cluster. The cluster member host name is specified as an argument to the -focus option. # sysman -cli -focus curley -list components Component(s): account_management atm auditconfig bindconfig bttape ciconfig . . . This example lists the values in the hostMappings group of the networkedSystems component: # sysman -cli -list values -comp networkedSystems -group hostMappings Component: networkedSystems Group: hostMappings {} {} 127.0.0.1 localhost ychain {group server}11.111.212.13 ychain.zz.dic.com paun {dev system} 11.111.212.31 paun.zz.dic.com nyth {} 11.111.212.50 nyth.zz.dic.com This group represents the contents of the /etc/hosts file, and is therefore a table, with rows of data organized in columns. Where there is no data in a cell, a null entry is displayed as {}. By looking at the attributes for the same group, we can see that they have the following names, each of which maps to a column in the table of data # sysman -cli -list attributes -comp networkedSystems -group hostMappings Component: networkedSystems Group: hostMappings Attribute(s): aliases comment networkAddress systemName Putting this information together gives you an idea of how the data is manipulated when you use sysman -cli to add rows or modify attributes in a table. Each attribute is a cell in the table as follows: Attr | aliases comment networkAddress systemName ------+-------------------------------------------------- Row 1 | {} {} 127.0.0.1 localhost Row 2 | ychain {group server} 11.111.212.13 ychain.zz.dic.com Row 3 | paun {dev system} 11.111.212.31 paun.zz.dic.com Row 4 | nyth {} 11.111.212.50 nyth.zz.dic.com You can also display columns of attribute data from the table by specifying a single attribute as follows: # sysman -cli -list val- ues -comp networkedSystems -group hostMappings -attr systemName Component: networkedSystems Group: hostMappings localhost ychain.zz.dic.com paun.zz.dic.com nyth.zz.dic.com This example will change attribute values for a particular entry in the hostMappings group of the networkedSys- tems component. The effect is to change an entry in the /etc/hosts file. Note that because this group is a table of several rows, you will be prompted to supply key data to identify the row that you want to change. # sysman -cli -set value -comp networkedSys- tems -group hostMappings Please enter key 1 [systemName]: bongo.aaa.bbb.ccc Please enter key 2 [networkAddress]: 111.222.111.112 Attribute Name: aliases Attribute Description: Alternate names for this system. Attribute Type: STRING(24), Current Value: Enter New Attribute Value (<CR> to keep unchanged): sysman Attribute Name: comment Attribute Description: End-of-line comment. Attribute Type: STRING(24), Current Value: Enter New Attribute Value (<CR> to keep unchanged): Central system for site system management. Attribute Name: networkAddress (key attribute) Attribute Description: The string of numbers identifying this system to a network. For example, 192.2.3.4. Attribute Type: STRING(24), Current Value: 111.222.111.112 Enter New Attribute Value (<CR> to keep unchanged): 111.222.111.222 Attribute Name: systemName (key attribute) Attribute Description: Full name of this interface to the network. For example, hostx.someco.com Attribute Type: STRING(24), Current Value: bongo.aaa.bbb.ccc Enter New Attribute Value (<CR> to keep unchanged): Component: networkedSystems Group: hostMappings Keys: 'bongo.aaa.bbb.ccc' & '111.222.111.222' Attribute: aliases Value: sysman Attribute: comment Value: Central system for site system management Attribute: networkAddress Value: 111.222.111.222 Attribute: systemName Value: bongo.aaa.bbb.ccc This example adds a host as a new row in the etc/hosts file: # sysman -cli -add row -comp networkedSystems -group hostMappings Attribute Name: aliases Attribute Description: Alternate names for this system. Attribute Type: STRING(24), Default Value: <NONE> Enter Attribute Value: news Attribute Name: comment Attribute Description: End-of-line comment. Attribute Type: STRING(24), Default Value: <NONE> Enter Attribute Value: the news server for the site Attribute Name: networkAddress (key attribute) Attribute Description: The string of numbers identifying this system to a network. For example, 192.2.3.4. Attribute Type: STRING(24), Default Value: <NONE> Enter Attribute Value: 150.2.3.4 Attribute Name: systemName (key attribute) Attribute Description: Full name of this interface to the network. For example, hostx.someco.com Attribute Type: STRING(24), Default Value: <NONE> Enter Attribute Value: newshst.pubs.com This example will add the given (complete) row of data to the hostMappings group of the networkedSystems component. The data for each attribute is enclosed in braces {}, and the entire set of attributes is enclosed by quotes ("" or ''). # sysman -cli -add row -comp networkedSystems -group hostMappings -data "{newsserver} {nsrv} {newsystem.site.com} {111.222.333.111}" This example shows how the -noverbose option can be used to limit the output to the minimal data necessary. First, the current NFS client configuration is shown in ver- bose mode. It is then followed by the same command in noverbose mode: # sysman -cli -list value -comp nfsconfig -group client Com- ponent: nfsconfig Group: client Attribute: name Value: cldhpr Attribute: configured Value: yes Attribute: locking Value: yes Attribute: locking_status Value: running Attribute: nfsiod Value: 8 Attribute: nfsiod_status Value: running Attribute: automount Value: yes Attribute: amargs Value: -h -v Attribute: automount_status Value: running Attribute: daemon_action Value: noaction Attribute: cluster_override Value: 0 # sysman -cli -noverbose -list value -comp nfsconfig -group client cldhpr yes yes running 8 running yes {-h -v} running noaction 0 This example shows how you create a configuration definition (cdf) file for the nfsconfig component, saving only the clientgroup which defines the current configuration of the NFS client. The compo- nentid group is saved automatically: # sysman -cli -cdf save -comp nfsconfig -file /cdftest -cdfgroups client Saving component nfsconfig (group: client) Saving component nfsconfig (group: componentid) The configuration file, /cdf_test has the following content for the /nfsconfig configuration settings: # # CDF Created: Thu May 27 14:55:17 EDT 1999 # # # Component: nfsconfig # # # Group: client # /nfsconfig/client: cdf_record=00000001 name=cymro configured=yes locking=yes locking_status=running nfsiod=7 nfsiod_status=running automount=yes amargs=-h -v -D MACH=ALPHA -D OS=OSF1 -D NET= automount_status=running daemon_action=noaction cluster_override=0 # # Group: componentid # /nfsconfig/componentid: manufacturer=manufacturer_name product=Network Filesystem Configuration version=NFS-1.1.4.19 serialnumber=1.1.4.19 installation=installation_number verify=7 Note that if you are not sure which groups of a component are configured, you can use the -cdfgroups ALL option and view the output file. The cdf file can be validated (checked) with the following command: # sysman -cli -cdf validate -file /cdf_test Validating component nfsconfig (group: client) Validating component nfsconfig (group: componentid) ENVIRONMENT VARIABLES
Normally not set. This is checked for the location of the MCL files. If this variable is unset, the /usr/share/sysman/mcl directory is used. FILES
The executable image. The default location of component MCL files Shell scripting examples SEE ALSO
Commands: sysman(8), sysman_station(8) System Administration sysman_cli(8)
All times are GMT -4. The time now is 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy