Results 1 to 6 of 6

Thread: I tried 3 methods to run a custom script at boot time but none work

  1. #1

    I tried 3 methods to run a custom script at boot time but none work

    Hi

    I'm trying to run my own custom shell script at boot time, but without success.
    I HAVE searched the forums but can't find an answer to my particular problem.

    (I've got Knoppix distro 7.0.2, ver 3.3.7, on hard disk, on Acer Aspire 5750 laptop.)

    My simple script is as follows:

    Code:
    #!/bin/sh
    
    # This script is to run programs and make settings that I want to effect after
    # I've just booted. It would be better if I could get this script to run
    # during the boot.
    
    # Cause the script command lines themselves to be DISPLAYED.
    
    set -x
    
    # Restore the volume settings that I stored with "alsamixer store".
    
    alsactl restore
    
    # cfg80211 and wl are kernel modules related to operating the wifi on my laptop.
    # wl enables my particular Broadcom wifi card BCM43227 to work.
    # The following commands ADD these modules to the kernel. "modprobe wl" makes
    # the wifi LED come on.
    
    sudo modprobe cfg80211
    sudo modprobe wl
    The script runs OK when I manually run it at a terminal prompt, after full
    bootup.

    To get it to run at boot time, I've tried placing the script in the following places (I made the script executable, with owner root):

    1. /KNOPPIX/knoppix.sh
    2. /etc/profile.d/JGstartup.sh
    3. /etc/rc5.d/S99JGstartup (a symlink to /etc/init.d/JGstartup)

    But it doesn't appear to execute in any of these cases. I would know if it had
    executed by seeing the laptop wifi light coming on (last instruction in
    script). But the light doesn't come on (as it dutifully does when i run the
    script from a terminal, after bootup).

    Could a kind person tell me what's wrong please. Thanks. John.

  2. #2
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    Greetings, John

    The commands you indicate here could all go into a few lines
    of /etc/rc.local.
    As root, use leafpad to put your lines just above the 'exit 0' line.
    These go in after all other boot stuff, but I think it'll be ok.

  3. #3
    Utu you're a genius. Thanks, your solution works. At some point I'd like to have a separate script file (or files) containing my personal scripts, that the boot executes (you know - not within rc.local), and earlier in the boot process preferably. But thanks for your present solution which will get me by for now.

    John

  4. #4
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    Greetings, John

    You are certainly a flatterer, but thanks.

    Klaus K provides additional alternatives in Knoppix you might want to examine.
    Quoting from /mnt-system/KNOPPIX/knoppix-cheatcodes.txt:

    If you place an update*.zip or update*tar.gz file on the medium holding
    the KNOPPIX data, it will be unpacked onto the overlayed filesystem
    before starting "init", thus allowing quick reconfiguration of the
    system.

    The file "knoppix.sh", if residing in the main KNOPPIX directory, will
    be execuded after autoconfiguration and before starting the graphical
    desktop. It can be used in order to start additional services.

  5. #5
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    Greetings again, John.

    Re-reading your initial post, it occurs to me that perhaps you just didn't find the right
    directory for your earlier attempts. The following is an earlier post of mine where
    I used Klaus K's update*.tar.gz idea. It looks like /mnt-system is what Klaus means
    by "on the medium holding the KNOPPIX data". Give that a try. It worked for me.

    http://knoppix.net/forum/threads/294...update*.tar.gz

  6. #6
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    Now I remember.

    I saved update*.tar.gz in /mnt-system as an inert 'backup'.
    I moved it, off-line, into /mnt-system/KNOPPIX/ and rebooted to apply it.

    So, /mnt-system/KNOPPIX is probably the 'right' directory for you in applying the
    update*.tar.gz idea.

Posting Permissions

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


Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot picture

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot

$285.90



Microsoft Office 2021 Pro Plus USB for 1PC Windows 10 & 11 picture

Microsoft Office 2021 Pro Plus USB for 1PC Windows 10 & 11

$62.55



Set of 2 HMAA4GR7CJR8N-XN HYNIX 32GB (1X32GB) 2Rx8 PC4-3200AA MEMORY  picture

Set of 2 HMAA4GR7CJR8N-XN HYNIX 32GB (1X32GB) 2Rx8 PC4-3200AA MEMORY

$500.00



MICRON MTA36ASF4G72PZ-2G6D1 32GB PC4-21300R DDR4-2666V RDIMM 2RX4 MEMORY DIMM picture

MICRON MTA36ASF4G72PZ-2G6D1 32GB PC4-21300R DDR4-2666V RDIMM 2RX4 MEMORY DIMM

$139.99



Samsung 64GB (16GBx4) 16GB 2Rx8 PC4-3200AA M393A2K43EM3-CWENY DDR4 Server Memory picture

Samsung 64GB (16GBx4) 16GB 2Rx8 PC4-3200AA M393A2K43EM3-CWENY DDR4 Server Memory

$399.99



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$826.09



USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot picture

USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot

$3.75



Samsung 64gb PC4-3200AA 2Rx4 DDR4 ECC LRDIMM Memory M393A8G40AB2-CWE - PARTS picture

Samsung 64gb PC4-3200AA 2Rx4 DDR4 ECC LRDIMM Memory M393A8G40AB2-CWE - PARTS

$1450.00



TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot picture

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot

$573.98



1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot picture

1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot

$202.50