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

Scipts don't run consistently.

Discussion in 'Tomato Firmware' started by Bird333, Feb 6, 2013.

  1. Bird333

    Bird333 Network Guru Member

    I am running Shibby 104 AIO. Trying to follow the guidance of this page http://infodepot.wikia.com/wiki/TomatoUSB_-_Script_Name_Extensions, scripts are not running consistently or at all it seems. I was putting scripts is /opt/etc/config directory. One of the scripts I tried to put in the directory was the 'ad blocking' script. Can something be done to make sure these scripts run? It would help save nvram space being able to take advantage of these capabilities.

    EDIT: Yeah, I misspelled scripts but I can't seem to change it. :)
     
  2. jerrm

    jerrm Network Guru Member

    Which extensions?
     
  3. Bird333

    Bird333 Network Guru Member

    I was trying '**-xxx.wanup'.
     
  4. jerrm

    jerrm Network Guru Member

    Is the drive consistently mounted at /opt in before the scripts are called?

    Have you accounted for possible race conditions as noted here http://tomatousb.org/tut:optware-installation ?

    Have you put in some basic logging to determine for sure the script is not being executed?
     
  5. Bird333

    Bird333 Network Guru Member

    I've got a script with '.fire' extension that you helped me with in the same directory and it runs. I haven't checked for race conditions. I have watched Wallwatcher to see if it runs and it doesn't appear to.
     
  6. Bird333

    Bird333 Network Guru Member

    I was mistaken. The script I have running is a '.usbmount' script not a '.fire'. I installed this for the race condition
    Code:
    #!/bin/sh
    if [ -f /var/notice/wan ]; then
       for s in /opt/etc/config/*.wanup; do $s; done
       for s in /opt/etc/config/*.fire; do $s; done
    fi
    It didn't make any difference. The '.wanup' script still didn't work.
     
  7. Bird333

    Bird333 Network Guru Member

    Is there something special about this script that won't run from a file on my harddrive? Here is the script
    Code:
    ## ALL-U-NEED Ad Blocking v3.9e
    ## http://goo.gl/mhykQ
    ## Original script by YAQUI
    ## Updated by ~nephelim~, Syl, jochen, groosh, ng12345, ray123, mstombs
    ## base64 decoder by Danny Chouinard's
    
    sleep 10
    
    ADB="/tmp/ADBLOCK.sh"
    {
    cat <<'ENDF' >$ADB
    #!/bin/sh
    
    OPTIMISE="Y"
    GETS="1 2 3 4"
    TRIM_BEGIN=3
    S1="http://pgl.yoyo.org/as/serverlist.php?hostformat=nohtml"  #44K
    S2="http://mirror1.malwaredomains.com/files/justdomains"    #189K
    S3="http://www.malwaredomainlist.com/hostslist/hosts.txt"   #97K
    S4="http://winhelp2002.mvps.org/hosts.txt"              #620K
    S5="http://hosts-file.net/hphosts-partial.asp"              #460K
    S6="http://hostsfile.mine.nu/Hosts"                         #2641K
    S7="http://support.it-mate.co.uk/downloads/hosts.txt"       #3851K
    
    USEWHITELIST="Y" # N/Y/R for remote
    WURL="http://example.com/whitelist.txt"
    WHITE="intel.com"
    BLACK=""
    
    USEPIXELSERV="Y"
    PXL_IP=192.168.22.2
    PXL_EXE="/opt/downloads/pixelserv/pixelserv"
    PXL_URL="http://example.com/pixelserv"
    
    UPLOAD="N"
    FTP_SERVER="example.com"
    FTP_USER=""
    FTP_PASS=""
    FTP_PORT=21
    FTP_PATH="/gen"
    
    ADD_CONF="N"
    USEHOSTS="N"
    ROUTER="Y"
    
    NIP="0.0.0.0"
    
    ENDF
    }
    
    UPDATE="Y"
    AUP() {
    if [[ "$UPDATE" == "Y" ]] ; then
    if [[ "$(cru l | grep AdUpd | cut -d '#' -f2)" != "AdUpd" ]] ; then
    cru a AdUpd "0 4 * * * $ADB"
    fi
    fi
    }
    
    #### DO NOT EDIT BELOW ####
    
    b64="openssl enc -base64 -d"
    [[ "$(echo WQ==|$b64)" != "Y" ]] && b64="b64" 
    
    b64(){
    awk 'BEGIN{b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}
    {for(i=1;i<=length($0);i++){c=index(b64,substr($0,i,1));if(c--)
    for(b=0;b<6;b++){o=o*2+int(c/32);c=(c*2)%64;if(++obc==8){if(o)
    {printf"%c",o}else{system("echo -en \"\\0\"")}obc=o=0}}}}';}
    
    {
    cat <<'ENDF'| $b64 |gunzip >>$ADB
    H4sIAJn5fk4CA61Xe2/aSBD/359iuvHFkKsx5Jq7Kt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pbcdSTB
    CXGFjeqmCzAnHA9Qq9vT+lmrsy45cg/I0e4oVndPTlTF3ba4lKiy/4f1IgWnpRGr
    LDpwcvknDIWjzVDYDoMEcqZFyKazv0964G0ZGXqOsCbneVLmF4IEm02ZvpLSRpmD
    ok5WTSqta+3LprPdWy6bLafebg2c3d4i3RlhLyWPEh0aJAkpYFZatiTJUpUta1iw
    hvh/YuQtjyk3kA357GWR/UwHWYfHJbap5+ODeiW8kFbU/GciSjikaGWLTxIAVplg
    qO0kmFUL3tBZ+YkO8r+g+msibhu3ynKSwvTTdqX6kUEqKUnLoY/C1F6iQxr55Oxu
    b9PX+N06bw3qu37etmEUhDKygGarQqGQDReavXZZyCtg3oEZqBwkGKT56OELmA0w
    CgYYlLtP3T4Ob+z7E5o6J+xOoyxOimVhmvlFKHzUX7A9VlZrhu3ou6ESTYpYrtjt
    bbEre4CQfkO2YpwTvscfc3rxrZd/Y5f29zuNN3Yx/+TZejFhrJsmCtYUBFpvgmAF
    possCEShSpN0y7bByFBkNu4VMtV5ZQlySLWjHOJ0HawhD9hjZ/CBzvO7tQqJgPtx
    KHikbjec3kVvM3l77W6l9tJIyPR+98Kp959J63ixuCNv6cj0Fp3aB3OhPnqVwQDM
    XvLR7TtqJWdPpEpInGbGv777v/HLTGCNWmdwvl2qXog9d5GWWxxYJEky3f757l26
    kakCOFotDR0nP5z1jWfOSwKbY6GIPyVYNb0VIamcUEtWciAbeV7Io8i29i3FeGms
    9FFlt9o4e50uQF3M4rFreX40H0VfC3Ikp8Sm54I8Tj/gw4d6t6GheN+kCLTXLyJN
    nhDYlxlmIVZqtW2QuHUrxTwD8hV6qAEbedqElWXHbtpF6TRzrzRqnCUKeVN3YY7u
    4mkQingUi3uphDvlZiT+5fZh8d17mS7mKPrmu/YRabqy9Gn7YzL3hPcC+2WiND4C
    gsVrYKf06jlojsWMKwUU/mePs3Zs0CBEFlq/L43k2s7rElKx2+mfyhERhHe+j8X4
    R20Eo0++cWTJTp2MRTtZrqDhmCDflvJ1g/OaHGhoHpBlSfYK+ktFRvtpBaHspLBO
    AocMj8rT81cK0v4De76CG9wPAAA=
    ENDF
    }
    
    chmod 775 $ADB
    $ADB
    AUP
    I have tried to run it with a '.wanup' ending and a '.usbmount' ending.
     
  8. Bird333

    Bird333 Network Guru Member

    Well I guess there isn't anything special about it because I got it to run once with the .usbmount ending but I couldn't repeat it. This emphasizes the point that scripts don't run consistently.
     
  9. leandroong

    leandroong Addicted to LI Member

    i dont have problem with script not running. My router always boot-up with camera broadcast and usb audio playing internet radio. I just use simple sh extension. auto extension also works all the time.
    Secret? You need to make sure that EOL is linux format, '0a' ending. and file is executable by running chmod +x. Lastly, add pause script before running it. This is what I use in init script as pausing.
    Code:
    # So.....lets just sleep until the sysup signal or we've been up for 5 minutess.
    A=600
    while [ $A -gt 0 ] && [ $(cut -f1 -d"." /proc/uptime) -lt 300 ]  ; do
    A=$(( $A - 1 ))
    if [ -f /var/notice/sysup ] ; then  break; fi
    sleep 1
    done
    run your script after this pause
     
  10. mstombs

    mstombs Network Guru Member

    fwiw you don't need the compressed hexdumped adblock script when running it from usb, it decompresses to ram disk and runs from there - there may be a script command with behaves a bit differently in the optware version, would be easier to debug with plain files!
     
  11. Bird333

    Bird333 Network Guru Member

    Where is there an optware version of this script?
     

Share This Page