Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minicom scripts 3

Status
Not open for further replies.

kevint21

Programmer
Apr 25, 2001
52
GB
I have installed Fedora Core as my Linux O.S I then connected it to the 16 port DIGI box EM and have successfully installed the driver for it. Then i installed Minicom 2.1 software.

I need to make my connection files for minicom and execute the scripts.

I have all the *.con files i'm going to use. I have also been asked to check a .profile autoexec file whatever that means. I can cd into /usr/term and cat the *.con files.

Any ideas what my next step is to execute the files using minicom
 
I think the fact that your first post didn't get a response should be a reasonable piece of feedback on whether anyone here knows minicom scripts.

Frankly, you should move to SSH and Bash scripting (or some simile thereof) instead of using scripts that can be viewed with simple network sniffers.

My opinion....

D.E.R. Management - IT Project Management Consulting
 
I believe that com and minicom are for direct connections via null modem serial cable and/or modems...

We use minicom for a serial terminal to veiw the system messages of a server on another workstation incase the server is locked up (i.e. can't get back to the first virtual terminal).

I'm not familiar with term or .con files.

"check a .profile autoexec file whatever that means"
.profile or .bash_profile often sets user enviroment for a user when they first log into a Linux/Unix system (depending on the shell).
autoexec sets the user enivroment and other things when booting DOS.

[plug=shameless]
[/plug]
 
Have you got minicom configured to use the DIGI COM ports? They should be /dev/tty with 2 or more characters, usually a capital letter and a number, like /dev/ttyS0.

You can create configurations for each of the serial ports in minicom. You call the different configurations using 'minicom config1' rather than just minicom. Generally the configurations must be created by root.

I'm not sure why you need to look at your .profile, but you can just vi it. It will be in your home directory and contains the commands that get executed when you log in to customize your environment. It is similar to an autoexec in that respect, except that each user gets their own environment, not one for all.

thedaver is right about security though. These files will contain userid (if you use them on your Meridian) and password in clear-text that can be read by anyone who can log in and use the scripts.

And I especially hope that you are not using root as the login for this system. You will be in a never-ending battle with the users of the system attempting to maintain configuration control.


pansophic
 
I am using PuTTy.exe to login via ssh port 22 so I can access the Linux box and view the menus. This is working. Its just the scripts that I need to tweak to access the menus. The menu is not working correctly yet because the scripts for it aren’t configured yet to execute minicom.

I have configured the .profile file in my home directory so that when I login as a normal user it executes the menus straight away (I only login as root to configure scripts, etc.).
Security is not an issue. I have 2 firewalls sitting in front of all the servers. CIA couldn’t get through them.

Minicom is configured already to use the DIGI Com Ports ie /dev/ttya01 to /ttya16

I just need advice on how to tweak the scripts which were used on the last Linux box to run the menus. The difference is that the new Linux box is using a program called Minicom to run the scripts and not TERM software. Our licence has run out on TERM and Minicom is free distribution software for Linux.
 
What are your scripts doing? Can you post them? If they have userid/password info in them, delete or change that part of the script.

Minicom has a scripting function, and I recall that it is fairly straight forward (haven't used it in a LONG time).

The conversion will almost certainly be a manual one, but you might be able to use a SEND/EXPECT script using minicom as the transport (believe this was done to get PPP working early on). If you can find an old PPP-HOWTO I believe that there were explicit instructions.


pansophic
 
Thanks for your reply
Here is script number 1 - if i could do this script then i think i would be able to do the rest of them as they are all similar.

remark file mer1.con
remark date 29-03-1994
remark login to Dial Plus
portlist "/dev/ttya01"
baud 1200
parity NONE
wordlen 8
stopbits 1
mode FULL
emulate VT220
xprot MODEM7
protocol ASCII
wru "VT220\r"
if hascolor()
COLOR DEFAULT 7,1
COLOR REVERSE 4,7
COLOR BLINK 0,2
COLOR UNDERLINE 1,2
COLOR BOLD 3,0
endif
CLS
SETKEY f1 "\e[?5i"
SETKEY f2 "\e[?4i"
SETKEY f3 "@@ DISPLAY '\rConnected to Bretland House Switch\r'"
SETKEY f4 "^E"
SETKEY f5 "^E"
SETKEY f7 CAPTURE
SETKEY f8 SHELL
SETKEY f9 "@@RUN lp -dEpson -o nobanner switch1.log "
CLS
call NONE
cls
? 'Please Wait....Connecting to Bretland House Switch....'
? 'Press F4 to return to Main Menu at any time'
wait 3
cls
xmit '\r'
PRINTER DEVICE /dev/lp0 OVERWRITE ON
remark CAPTURE DISK /usr/term/switch1.log OVERWRITE ON
remark ADDCR ON
TERMINAL
CAPTURE CLOSE
cls
? 'Please Wait....returning to Main Menu....'
quit

----
The script executes TERM at the moment. I need it to execute MInicom instead. Thats it really.
 
I didn't see any dialing information, so I am assuming that each serial port is either directly connected to the remote system, or that you are using leased-line modems or line drivers to get the serial port to the system.

I looked at a couple of options, but the most straight forward seems to be a simple shell script that calls minicom. You will have to configure each serial port connection and save it as a minicom configuration. Once you have the configuration correct, you can use Ctrl-A o and use the "Save setup as.." option to save the configuration with a name. You open that configuration with "minicom configuration_name" and use a -D option if you are doing a dial-up.

Code:
#!/bin/bash
#
#**************************************************************************
#*                                                                        *
#*  term_script.sh                                                        *
#*  23 December, 2005                                                     *
#*                                                                        *
#*  created by: pansophic                                                 *
#*                                                                        *
#*  Shows a menu with numeric options to choose a system                  *
#*  The current options are 1, 2, and 3.  Any other option will display   *
#*  an error message and then print a new menu.                           *
#*                                                                        *
#*  Each of the menu items requires that the a minicom configuration      *
#*  must have been previously saved.                                      *
#*                                                                        *
#*  Use a Ctrl-C to exit the shell script and get back to a command       *
#*  prompt.                                                               *
#*                                                                        *
#**************************************************************************

while [ 1 ] 
do
    clear  # clear the screen

    # display the menu
    echo " "
    echo " "
    echo "     ***************************************************************"
    echo "     **                                                           **"
    echo "     **              Enter the number of the system               **"
    echo "     **                                                           **"
    echo "     **              1 - Meridian 1                               **"
    echo "     **              2 - Bretland House Switch                    **"
    echo "     **              3 - default                                  **"
    echo "     **                                                           **"
    echo "     ***************************************************************"
    echo " "
    echo " "

    read input                  # read character input

    case $input in
	1) minicom meridian1;;  # minicom with the "meridian1" configuration
	2) minicom bretland;;   # minicom with the "bretland" configuration
	3) minicom;;            # minicom with the default configuration
	*) clear
	    echo " "
	    echo " "
	    echo "I didn't understand that input."
	    sleep 5;;           # leave the message on the screen for 5 seconds
    esac

    $0                          # issue this command again

done

You can copy this code and paste it into a file using emacs or vi (or your favorite editor). After you save the file, do a "chmod +x <filename>" to make the shell script executable. You can put it in a logical place like /usr/local/bin so that everyone can execute it.


pansophic
 
I have installed Linux Fedora Core 2and have installed Minicom 2.1 to connect to a PORTS/16em DB25 serial interface (digi box). The driver for this hardware is installed. I want to configure the startup script for a user called doe1 so when doe1 logs into Linux, a minicom script is run and a menu appears. I have edited the .bash_profile for the user doe1

Menu is the main file and points to the rest of the menu files. All the *.con files are connection files for a unix program called term which was used previously. I want to make my own connection files for minicom and change the scripts execute minicom instead of term.

I logged in as an administrator to set up the first script (mer1.con) connecting a DB25 cable on the first interface (ttya01) on the DIGI box. I need to go through each interface i.e. ttya01 to ttya16 and get minicom to work and save the login script for each interface.

I use "minicom -s" to change parameters to default (dfl)
pr port /dev/ttya01
pu baudrate 1200
pu bits 8
pu parity N
pu stopbits 1

I have created the menu and it looks like this

setcolor yellow blue
var1=yes
var2=no
echo \\033[H \\033Y \\n
clear
until (test "$var1" = "$var2")
do
echo ' HHH HHH OOOOOOOOOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHHHHHHHHHHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo ' HHH HHH OOO OOO'
echo 'HHH HHH OOOOOOOOOO M&E Management Access'
echo ' ---------------------'
echo ''
echo ' [1] ..... Meridian Switches'
echo ' [2] ..... Nokia'
echo ' [3] ..... Router Access'
echo ' [4] ..... Serck Router Access'
echo ' [5] ..... Micom Access'
echo ' [6] ..... MDS Radios'
echo ' [7] ..... BERT Tester'
echo ' '
echo ' [0] ..... Quit'
echo ''
echo ' Please enter choice> '\\c
read choice
if test "$choice" = 1
then
clear
meridian
clear
elif test "$choice" = 2
then
clear
nokia
clear
elif test "$choice" = 3
then
clear
router
clear

etc,etc - hopefully you now see how this works

this is an example of one of the .con (connection) files which are shell scripts

setcolor yellow blue
var1=yes
var2=no
echo \\033[H \\033Y \\n
clear
until (test "$var1" = "$var2")
do
echo ' ************************************'
echo ' * *'
echo ' * MERIDIAN MANAGEMENT ACCESS *'
echo ' * *'
echo ' ************************************'
echo ' '
echo ' '
echo ' '
echo ' Bretland......a Newry.........k '
echo ' Ballykeel.....b Seagoe........l '
echo ' Downpatrick...c Conlig........m '
echo ' Antrim........d Northland.....n '
echo ' Coleraine.....e Marlborough...o '
echo ' Lisburn.......f Academy.......p '
echo ' College Sq....g Altnagelvin...q '
echo ' Enniskillen...h Westland......r '
echo ' Omagh.........i Hampden.......s '
echo ' Armagh........j Mark Royal....t '
echo ' Voice Mail....u '
echo \\n
echo ' Exit .........x'
echo \\n
echo ' ENTER CHOICE> '\\c
read choice
if test "$choice" = a || test "$choice" = A
then
clear
term -u mer1.con
clear
elif test "$choice" = b || test "$choice" = B
then
clear
term -u mer2.con
clear
elif test "$choice" = c || test "$choice" = C
then
clear
term -u mer3.con
clear
elif test "$choice" = d || test "$choice" = D
then
clear
term -u mer4.con
clear
elif test "$choice" = e || test "$choice" = E
then

etc etc etc

Q. How do i get each script to execute minicom instead of the TERM software we previously used. See above how it says term -u mer4.com
 
You've got the script pretty close, but instead of:

Code:
       read choice
   if test "$choice" = 1
     then
       clear
       meridian
       clear

You need to use this instead:

Code:
       read choice
   if test "$choice" = 1
     then
       clear
       minicom meridian
       clear

First you have to create a configuration for "meridian" which includes all of the settings that you want. Set a configuration and use Ctrl-a, o. Then select "Save setup as.." and type meridian into the dialog box.

You need to do that for each configuration.


pansophic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top