Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    expect and minicom as background process

    hy, sorry for my english first
    i have a script wich use except for setting a switch configuration
    script accept parameters : ip,netmask and gateway ex:
    script conect to switch serial port thrue minicom and expect do the rest of the configuration automaticaly

    from command line works perfectly but it takes about 1 minute to finish

    what i want is running this in background as a process

    tried with nohup but no luck

    i dont know how to use minicom as a background process or is there any way to acomplish this without minicom...tried also picocom or stty but i'm not a linux expert

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    minicom is a user-facing application - it expects a sane source/sink for stdin and stdout/stderr. You can try redirecting these in your script (run with nohup) to /dev/null and see if that works. IE,
    nohup ./myscript ... </dev/null >/dev/null 2>/dev/null &
    This may not work, but keep experimenting!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    i need a way to know if the script is running without erros so redirecting to dev/null doesn't help

    here's what my script looks like :
    #!/usr/bin/expect -f

    set force_conservative 1
    if {$force_conservative} {
    set send_slow {1 .01}
    proc send {ignore arg} {
    sleep .1
    exp_send -s -- $arg
    set IP [lindex $argv 0]
    set NM [lindex $argv 1]
    set GW [lindex $argv 2]
    set vlan_mng 7
    set vlan_mng_name "Vlan_mng"
    set vlan_ppp 2
    set vlan_ppp_name "Vlan_ppp"
    set vlan_iptv 9
    set vlan_iptv_name "Vlan_iptv"
    set timeout -1
    spawn minicom sw -o

    and on the end of the script i have :

    expect -re "Disconnected*"
    puts "\rFINISH!\r"

    # Reset System
    #send -- "8"
    #expect -re "Cancel*"
    #send -- "\t\r"
    # Reset System

    i have a few network switch models so i'm thinking to make a web page and from there i can select a switch model from a dropdown menu, put ip data in a field and have a button "EXECUTE" witch runs this script in background but also wana know if there is some way to know if the script was running without errors

    i was looking for some proc_open examples, but my problem is that minicom loose input/output if i run it in background

    thanks Rubberman for your input

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts