Results 1 to 6 of 6

Thread: Shell scripts and post-boot

  1. #1
    Join Date
    Jun 2005
    Location
    Karlsruhe, Germany
    Posts
    44

    Question Shell scripts and post-boot

    Hi you,

    I am using Olegs Firmware 1.9.2.7-5a on USB stick and it works fine. But I do not understand, why not all lines in post-boot are executed. Could someone give me a hint please?

    Here is my post-boot file. The marked lines are not executed, but the commands can be executed via command line.

    Code:
    #!/bin/sh
    dropbear
    /usr/sbin/smbd -D
    touch /usr/local/sbin/1
    /usr/sbin/nmbd -D
    touch /usr/local/sbin/2
    >>>/sbin/wshaper start "$" 1400 270
    touch /usr/local/sbin/3
    /bin/crond
    touch /usr/local/sbin/4
    >>>/tmp/harddisk/accounting/add_iptables.sh
    touch /usr/local/sbin/5
    >>>busybox_httpd -p 81 -u admin -h /tmp/harddisk/accounting/www81
    touch /usr/local/sbin/6
    All my shell scripts can only be executed on the command line if I type sh <scriptname>. If I type <scripname> only an error occurs.

    Example:
    Code:
    [admin@WL500 root]$ ls -l
    -rwxr-xr-x    1 admin    root           52 Jun  3 20:17 fix.sh
    [admin@WL500 root]$ cat fix.sh
    #!/bin/sh
    flashfs save
    flashfs commit
    flashfs enable
    [admin@WL500 root]$ fix.sh
    -sh: fix.sh: not found
    [admin@WL500 root]$ sh fix.sh
    tar: Removing leading '/' from member names
    var/spool/cron/crontabs/root
    etc/smb.conf
    ...OK
    What could that be?

    Thx
    Thomas
    Last edited by samoht; 03-06-2005 at 21:40.

  2. #2
    The wshaper should be $1 no or eth1 if that is you WAN? And should be in post-firewall? And the others are most likely cause harddisk is not mounted yet when post-boot is executed. You should put those lines in post-mount.

    Check http://oleg.wl500g.info for details about booting and wondershaper.

    B.

  3. #3
    Join Date
    Apr 2004
    Location
    Netherlands
    Posts
    1,308
    Code:
    /sbin/wshaper start "$1" 1400 270
    This line should be put in the post-firewall script because "$1" is a parameter of that script and therefore it doesn't work in the post-boot script.

    Edit:
    Code:
    cat fix.sh
    #!/bin/sh
    flashfs save
    flashfs commit
    flashfs enable
    You better do not put these commands in a script, because you need to check if the resulting file from 'flashfs save' isn't bigger then 64kbytes. If you make an error of some sort and you 'flashfs commit' a file that is larger then 64k your router might suffer unreversable damage.
    Last edited by Styno; 03-06-2005 at 21:36.

  4. #4
    Join Date
    Jun 2005
    Location
    Karlsruhe, Germany
    Posts
    44
    Thanks for your quick reply. Booting works now. But why does my fix.sh not work? Do I need it to copy to special folder?

    Thomas

  5. #5
    Don't know why, probably some *nix wiz can tell you, but to run shell script you need to either sh script or ./script. Or you can stick it in /usr/local/sbin/ and run it from anywhere..

    B.

  6. #6
    Join Date
    Jul 2004
    Location
    near Lyon @ France
    Posts
    195
    For security reason, ./ directory (i.e the actual directory) is never part of the PATH for root user.
    That's why you have to launch your script (or whatever executables) using ./script.sh or place it in a directory which belong to the PATH var (see 'echo $PATH')

    jf

Similar Threads

  1. Start own script in post-boot or post-firewall
    By m-h-l in forum WL-500g Q&A
    Replies: 2
    Last Post: 30-09-2005, 19:03
  2. Howto run post-boot when ftp is off
    By Jethro in forum WL-500g Q&A
    Replies: 6
    Last Post: 27-08-2005, 21:54
  3. Post Your Useful Scripts
    By tomilius in forum WL-500g Custom Development
    Replies: 2
    Last Post: 05-06-2005, 10:01
  4. Replies: 9
    Last Post: 18-02-2005, 19:42
  5. Replies: 3
    Last Post: 24-12-2004, 19:13

Posting Permissions

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