1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why can't I run optware screen inside script ?

Discussion in 'Tomato Firmware' started by leandroong, Mar 3, 2014.

  1. leandroong

    leandroong Addicted to LI Member

    No error display. Sample script
    Given:
    1. screen.sh
    #!/bin/sh
    /opt/bin/screen -dmS test sh /media/dl/aria2_downloads/test.sh

    2. test.sh
    #!/bin/sh
    touch /media/dl/aria_downloads/hello.txt
    ++++

    Run: sh screen.sh
     
  2. leandroong

    leandroong Addicted to LI Member

    Possible busybox error?
    Expected blank file was not created.
     
  3. leandroong

    leandroong Addicted to LI Member

    I dont think busybox, cause it works if run on command prompt.
     
  4. Grimson

    Grimson Networkin' Nut Member

    You need to post more information! From where are you running this command?
     
  5. koitsu

    koitsu Network Guru Member

    This has to do with tty/pty allocation, especially if you're trying to run this as an Init script somehow. Plain and simple -- this won't work.

    screen is not for this task, assuming all you want to do is run a process in "the background". You should be using nohup, combined with redirecting stdout/stderr to log files or /dev/null as needed.
     
  6. leandroong

    leandroong Addicted to LI Member

    BusyBox v1.21.1 (2014-02-13 22:39:16 KRAT) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    /opt/home/admin # screen -dmS aria2 sh /media/dl/aria2_downloads/aria2_dl.sh
    "" .cache/ .local/ index.html
    .ash_history .config/ .ssh/
    /opt/home/admin # screen -dmS aria2 sh /media/dl/aria2_downloads/aria2_dl.sh
    /opt/home/admin # screen -list
    There is a screen on:
    22917.aria2 (Detached)
    1 Socket in /opt/tmp/screens/S-root.

    /opt/home/admin #
     
  7. leandroong

    leandroong Addicted to LI Member

    what I want is to put that screen command in another script for simpler calling.
     
  8. leandroong

    leandroong Addicted to LI Member

    Actually, my purpose is to run this remotely using 1 line, " ssh root@myrouter sh run_aria.sh"
     
  9. leandroong

    leandroong Addicted to LI Member

    Solved. I found better solution. I use putty command link to run remote script with optware "screen" on it. It works well. Create windows shortcut on start menu and click it whenever i want to execute it.
     

Share This Page