Sponsored Content
Top Forums Shell Programming and Scripting expect telnet script execute by cronjob Post 302575758 by cssanangeles on Tuesday 22nd of November 2011 07:26:19 PM
Old 11-22-2011
expect telnet script execute by cronjob

hi, please help, keep getting this bolded error and look it up and people say
its your environment variable though i tried to set it manually in expect..it run fine if i run it manually but once i run it by cronjob it error below..i tried to comment out ip/login info with *..

Code:
logfile::
START OF SCRIPT
****************************SERVER:**********************
*********************************************************
array set ::env {LS_COLORS {} LESSOPEN {|/usr/bin/lesspipe.sh %s} 
TERM xterm CVS_RSH ssh SHELL /bin/bash ORACLE_BASE /u01/app/oracle SHLVL 2 G_BROKEN_FILENAMES PATH /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/sbin/:/usr/sbin:/home/oracle/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin:/u01/app/oracle/product/11.2.0/dbhome_1/OPatch:. _ /home/oracle/scripts/msa_config.exp USER oracle}
spawn telnet *****
manage
!Trying ****...

Connected to *****.

Escape character is '^]'.

Login: login
Password: *******

HP StorageWorks ***
System Name: ***
System Location: 
Version: W441P28

# show vdisk 
Name Size     Free    Own Pref   RAID   Disks Spr Chk  Status Jobs      
Press any key to continue (Q to quit)


expect script:
set env(TERM) xterm
set env(PATH) /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/sbin/:/usr/sbin:/home/oracle/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin:/u01/app/oracle/product/11.2.0/dbhome_1/OPatch:.

####set below to repopulate the environment
unset -nocomplain ::env(SSH_AUTH_SOCK)   ;# This one is session-bound anyway
puts[list array set ::env [array get ::env]]

set prompt "#"
set timeout -1
spawn telnet [lindex $argv 0]
match_max 200000
send -- "login\r"
expect -exact "login\r"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "*"
expect -exact "*"
send -- "\r"
expect "$prompt"
send -- "show vdisk \r"
send -- "exit \r"
expect eof

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to execute a program at expect script

what i need is that after passwordless enter another program should execute. I can succeed passwordless login but ı could not execute (./son) program. pls help me (6 Replies)
Discussion started by: fozay
6 Replies

2. Shell Programming and Scripting

Telnet Expect script question

Hi all, I have written a small expect script which should spawn a telnet session login and execute some commands. #!/usr/bin/expect -f spawn telnet $env(IP) match_max 100000 expect "login:" send -- "******\n" expect -exact "Password:" send -- "****\n" expect "%" Now I have got... (2 Replies)
Discussion started by: stinkefisch
2 Replies

3. Shell Programming and Scripting

Expect script to automate telnet session

Hi all, I am currently running a daemon which creates a virtual terminal for testing purposes. Essentially, if I were to interact with it manually, this is what I get. john@test1:~$telnet localhost 7777 Trying ::1... Connected to localhost. Escape character is '^]' mip6d> pl eth2... (6 Replies)
Discussion started by: abxccd
6 Replies

4. Shell Programming and Scripting

Execute Shell Script from CRONJOB

Hi Users, I am Newbie to linux and cron. I have a requirement to run a job at 8 AM every Sunday. I am using RHEL 5. Based on the hints through google search I created crontab and added entry to call the shell script which will in turn login to Oracle user and execute a pl/sql block. ... (1 Reply)
Discussion started by: reachravi70
1 Replies

5. Shell Programming and Scripting

EXPECT script for Telnet automation. Need your support.

Dear experts, please help me . I've found simple EXPECT scripts and all works fine. But I need more automation in error handling and sending list of commands/output logging from multiple remote hosts. I have 10 hosts, for example: host1 192.168.1.1 LOGIN1 PASSWORD1 ...... ... (2 Replies)
Discussion started by: starchen
2 Replies

6. Shell Programming and Scripting

Calling Expect Script - Telnet

Hi All, I have an Expect script which logs into Cisco switch, performs a show interface command. I want to read a file of ip addresses which will be passed to the expect script. The script to read the file works, the expect script works on it's own but when i call the 'expect' script from the... (12 Replies)
Discussion started by: trinak96
12 Replies

7. Shell Programming and Scripting

Expect script cronjob running but dying prematurely

I have an Ubuntu machine that I'd like to update automatically. I've written an expect script to run the aptitude package manager and update my packages. Essentially it does: aptitude update && aptitude upgrade while answering "yes" at the appropriate time. It works quite nicely when run... (4 Replies)
Discussion started by: CluelessPerson
4 Replies

8. Shell Programming and Scripting

Expect script to execute a script on a remote host

Hi, I am new to the expect scripting. I have this expect script as below : spawn ssh remote_server -l id set pass "12345" set opt "s" expect "Password:" {send "$pass\r" ; } expect "*ENTER*" {send "Enter\r"; exp_continue } expect "Please select option :" {send... (2 Replies)
Discussion started by: curt137
2 Replies

9. Red Hat

Execute expect script during firstboot

closed (1 Reply)
Discussion started by: AbhishekAgrawal
1 Replies

10. Shell Programming and Scripting

How to execute commands on remote server using expect script?

I need to copy python script file to around 100 servers using expect script. 1. Copy script to my user home first(/home/myhome) on each remote server 2. change permissions on copied file to 766. 3. sudo to appuser1 account on remote server. copy script file from my user home to /usr/bin/... (1 Reply)
Discussion started by: kchinnam
1 Replies
biomaj(1)							   USER COMMANDS							 biomaj(1)

NAME
biomaj - downloads and transform remote biological data banks SYNOPSIS
biomaj [-h] DESCRIPTION
BioMAJ (BIOlogie Mise A Jour) is a workflow engine dedicated to data synchronization and processing.The Software automates the update cycle and the supervision of the locally mirrored databank repository. User must have roots rights to run biomaj. OPTIONS
-h display the list of commands. INSTALL
At installation, BioMAJ requires a database to run (MySQL), installer should first create a database (biomaj_log) and a database user (the one used at installation setup). The database configuration for biomaj can be set or modified in /etc/biomaj/db_properties/global.properties. In the install fails due to a SQL error, the install script must be manually run to create/upgrade the database: perl /usr/share/biomaj/sql/migration/update.pl The script will create/upgrade the database and update the configuration files. ADMIN USER
A default admin user (admin) is created by the scripts. If using the biomaj-watcher, the default password (admin) MUST be changed immedi- atly via the watcher interface. If only biomaj core is used, password is useless. .PP UPGRADE
In the case of a package upgrade, if properly configured, the migration scripts will be ran automatically at install. It is possible to run manually the script: .B See perl /usr/share/biomaj/sql/migration/update.pl -h for usage. DATA BANKS
By default, biomaj is configured (data.dir in global.properties) to write banks to /var/lib/biomaj. EXAMPLES
Update a bank: biomaj --update genbank Show console biomaj --update genbank --console Show status: biomaj --status EXIT STATUS
biomaj returns a zero exist status if it succeeds, it does not represent the bank update status. AUTHOR
Olivier Sallou (olivier.sallou (at) irisa.fr) Romaric Sabas (romaric.sabas (at) irisa.fr) version 1.2.0 September 14, 2011 biomaj(1)
All times are GMT -4. The time now is 05:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy