Loading ...
Sorry, an error occurred while loading the content.

Re: Where to put this startup script?

Expand Messages
  • linksysslug
    Ok, it looks as though I should probably just look into a fresh, new script that replaces the one currently in the wiki, and adds the option to write the logs
    Message 1 of 7 , Jul 8, 2012
    • 0 Attachment
      Ok, it looks as though I should probably just look into a fresh, new script that replaces the one currently in the wiki, and adds the option to write the logs on reboot/shutdown. In the meantime, there doesn't seem to be too much log activity writing to my flash disk anyway, so I don't think there's the rush I thought there'd be.

      Ta :)

      --- In nslu2-general@yahoogroups.com, Robert Hammond <rob.hammond@...> wrote:
      >
      > Most of the scripting is taken from /etc/rc.d/rc.sysinit which I think is
      > the first script to execute during boot up.
      > Perhaps not all of the lines are actually needed, the original script
      > section was written by the core unslung developers.
      >
      > If you want to save the contents of /var/log then I think two identical
      > scripts are needed - /unslung/rc.halt and /unslung/rc.reboot to cover both
      > shut down methods.
      > Unsure of the best place to copy to, perhaps a folder in /opt or perhaps
      > you could create a folder under /unslung
      >
      >
      >
      > On 2 July 2012 11:12, <sirquijote@...> wrote:
      >
      > > Thanks for the explanation. I'm beginning to come to grips with uNSLUng
      > > now.
      > >
      > > Just a couple of questions regarding the scripts. In yours, I notice you
      > > use "mkdir -p" when creating the "/var.state" file. By my understanding
      > > of "-p", isn't it redundant in that case? AFAIK its purpose is to
      > > automatically create non-existent folders specified in the input (eg.
      > > mkdir -p /1/2/3/4/var.state would create /3/4 if they didn't already
      > > exist).
      > >
      > > Also, what's the purpose of the var.state file? Both yours and the one in
      > > the wiki use it, but I can't determine its function.
      > >
      > > And, neither yours nor the script in the wiki seems to enable the writing
      > > of the contents of ramfs's logs on shutdown or reboot. How would I add
      > > that?
      > >
      > > Finally: why do both scripts unmount /mnt (or in your case, /mnt/tmpmnt)
      > > after creation? Seems counter-intuitive, but then like I say, I'm no
      > > script guru. ;)
      > >
      > > > Yes...
      > > >
      > > > With unslung during boot up it looks in the /unslung folder as each
      > > system
      > > > boot script is run.
      > > > Some time ago, by trial and error approach, it was confirmed that for
      > > > re-mounting some of the system drives you need to use a custom script in
      > > > rc.bootbin rather than in one of the other boot scripts.
      > > >
      > > > So regarding the bootbin script, the first section of the system
      > > provided
      > > > rc.bootbin will call and run your custom rc.bootbin located in /unslung.
      > > >
      > > > The last line of your custom rc.bootbin can be either 'return 0' which
      > > > would abort the remainder of the system bootbin script or 'return 1' to
      > > > run the remainder of the system bootbin.
      > > > You should use 'return 1'
      > > >
      > > > Hence
      > > >
      > > > The first script line needs to be '#!/bin/sh' (or change it use a
      > > > different shell)
      > > >
      > > > and
      > > >
      > > > the last script line needs to be 'return 1'
      > > >
      > > >
      > > > In between these two line you place your custom script section (but
      > > > suggest
      > > > that you test it first before committing it to /unslung/rc.bootbin).
      > > >
      > > >
      > > >
      > > >
      > > > On 30 June 2012 10:49, linksysslug <sirquijote@...> wrote:
      > > >
      > > >> If I understand correctly, could I get away with simply moving the
      > > >> script
      > > >> I already have in rc.d, renaming it rc.bootbin and making it r-xr-x--?
      > > >> Or
      > > >> is there something amiss in the script I'm currently using that yours
      > > >> corrects? It's just, the less I have to think about the actual content
      > > >> of
      > > >> scripts the fewer headaches I get :)
      > > >>
      > > >> Ta :)
      > > >>
      > > >> --- In nslu2-general@yahoogroups.com, Robert Hammond <rob.hammond@>
      > > >> wrote:
      > > >> >
      > > >> > 1. Create a folder off of the system root called unslung (this
      > > >> folder
      > > >> may
      > > >> > exist)
      > > >> >
      > > >> > 2. Inside the unslung folder create a text file called rc.bootbin
      > > >> >
      > > >> > 3. Flag the file as executable
      > > >> >
      > > >> > 4. Then edit rc.bootbin with your move script. I have pasted the
      > > >> script
      > > >> > that I use below, used with my unslung version 5.5 slug. You will
      > > >> need
      > > >> to
      > > >> > tweak it a little for /var/log and perhaps may need some tweaks for
      > > >> later
      > > >> > versions of unslung. Probably details in the wiki somewhere.
      > > >> >
      > > >> >
      > > >> > #!/bin/sh
      > > >> > # /unslung/rc.bootbin
      > > >> > # Intended for unslung firmware 4.x and 5.5
      > > >> > # Script section to create ramdisk for /var and /dev
      > > >> >
      > > >> > /bin/echo "Creating ramfs for /var:"
      > > >> > /bin/mount -t ramfs ramfs /mnt/tmpmnt -o maxsize=256
      > > >> > /bin/cp -rp /var/* /mnt/tmpmnt/
      > > >> > /bin/mkdir -p /var.state
      > > >> > /bin/mount -o bind /var /var.state
      > > >> > /bin/mount -o bind /mnt/tmpmnt /var
      > > >> > /bin/umount /mnt/tmpmnt
      > > >> >
      > > >> > /bin/echo "Creating ramfs for /dev:"
      > > >> > /bin/mount -t ramfs ramfs /mnt/tmpmnt -o maxsize=128
      > > >> > /bin/cp -rp /dev/* /mnt/tmpmnt/
      > > >> > /bin/mkdir -p /dev.state
      > > >> > /bin/mount -o bind /dev /dev.state
      > > >> > /bin/mount -o bind /mnt/tmpmnt /dev
      > > >> > /bin/umount /mnt/tmpmnt
      > > >> >
      > > >> > # Restart Logging Daemons
      > > >> > /opt/bin/killall syslogd
      > > >> > /opt/bin/killall klogd
      > > >> >
      > > >> > # Return and continue execution of system rc.
      > > >> > return 1
      > > >> > # EOF - include this line
      > > >> >
      > > >> >
      > > >> > On 29 June 2012 01:17, Linksys Slug <linksysslug@> wrote:
      > > >> >
      > > >> > > I'm following the advice here, re: reducing flash drive writes:
      > > >> > >
      > > >> > > http://www.nslu2-linux.org/wiki/Unslung/Ext3flash
      > > >> > >
      > > >> > > He doesn't mention where to save the script that moves /var/log and
      > > >> /dev
      > > >> > > into ram. He says he's modified a similar script from here:
      > > >> > > http://www.nslu2-linux.org/wiki/FAQ/SpinDownUSBHarddisks
      > > >> > >
      > > >> > > That one says to put it in /etc/init.d/ with a symlink to here:
      > > >> > >
      > > >> > > cd /etc/rcS.d
      > > >> > >
      > > >> > > I can't find a /etc/rcS.d directory. I have a /etc/rc.d, so I
      > > >> created
      > > >> the
      > > >> > > symlink there, but on reboot /var/log and /dev aren't in ram.
      > > >> Anyone
      > > >> know
      > > >> > > where the symlink's supposed to go?
      > > >> > >
      > > >> > > I'm running uNSLUng latest with a boot flash drive in port 1.
      > > >> > >
      > > >> > > Also, does anyone know if Privoxy (which is the only thing I'm using
      > > >> the
      > > >> > > slug for) can run in the remaining memory? The guy proposing the
      > > >> hack
      > > >> > > above is using Firefly with no problems, but I don't know how it
      > > >> compares
      > > >> > > in ram footprint.
      > > >> > >
      > > >> > > [Non-text portions of this message have been removed]
      > > >> > >
      > > >> > >
      > > >> > >
      > > >> > > ------------------------------------
      > > >> > >
      > > >> > > Yahoo! Groups Links
      > > >> > >
      > > >> > >
      > > >> > >
      > > >> > >
      > > >> >
      > > >> >
      > > >> > [Non-text portions of this message have been removed]
      > > >> >
      > > >>
      > > >>
      > > >>
      > > >>
      > > >> ------------------------------------
      > > >>
      > > >> Yahoo! Groups Links
      > > >>
      > > >>
      > > >>
      > > >>
      > > >
      > > >
      > > > [Non-text portions of this message have been removed]
      > > >
      > > >
      > > >
      > >
      > >
      > >
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.