Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to start automatically a script after that the knoppix user is logged on.

  1. #1
    Junior Member registered user
    Join Date
    Mar 2009
    Posts
    17

    How to start automatically a script after that the knoppix user is logged on.

    Hello to everyone,

    I'm trying to make a customized version of KNOPPIX 6.2 that should run totally in RAM.
    The customizations I need to do are very few :

    1) automount in write mode the first two NTFS/FAT32 partitions of the first hard disk
    2) mount the CD/ROM after the default user (knoppix) or (root ?) is logged on
    3) start automatically a session of DOSEMU after that the knoppix user is logged on

    This is what I did while I was in chroot :

    apt-get install dosemu

    cd /mnt
    mkdir cdrom
    mkdir hda1
    mkdir hda2
    mkdir sda1
    mkdir sda2

    cd /home/knoppix/.dosemu/drives/c

    nano autoexec.bat

    lredir e: linux\fs/mnt/cdrom c
    lredir f: linux\fs/mnt/hda1
    lredir g: linux\fs/mnt/hda2
    lredir h: linux\fs/mnt/sda1
    lredir i: linux\fs/mnt/sda2

    nano /home/knoppix/.bash_profile

    #!/bin/sh
    clear
    read -p "Insert your Windows installation disk and press a key to continue" disco
    sudo mount -t auto /dev/cdrom /mnt/cdrom
    dosemu

    mv /etc/skel /etc/skel-old
    mv /home/knoppix /etc/skel
    chown root:root -R /etc/skel

    cp -Rp /etc/skel /home/knoppix
    chown knoppix:knoppix -R /home/knoppix

    When Knoppix starts the script I put in /home/knoppix/.bash_profile is not executed. Why ?
    The folder /home/knoppix is empty. Instead,I have everything on /etc/skel/,like the .dosemu folder and the .bash_profile script. I would like that it is placed on /home/knoppix and that it is executed when the knoppix starts. Thanks.

  2. #2
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    I'm trying to make a customized version of KNOPPIX 6.2 that should run totally in RAM.
    It would help me if you'd expand this more.

    An obvious question is: have you considered the 'toram' cheatcode?

  3. #3
    Junior Member registered user
    Join Date
    Mar 2009
    Posts
    17
    Yes,I will use this option,but the problem now is that I don't know how to start automatically the script inside .bash_profile when the Knoppix has been loaded in Ram

  4. #4
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    You can start any program at the end of the boot process
    via a script in /etc/rc.local.

    Does that help?

  5. #5
    Junior Member registered user
    Join Date
    Mar 2009
    Posts
    17
    /etc/rc.local

    SERVICES="cups"

    for i in $SERVICES; do
    [ -x /etc/init.d/"$i" ] && /etc/init.d/"$i" start >/dev/null 2>&1
    done

    /etc/skel/script.sh

    exit o


    /etc/skel/script.sh

    #!/bin/sh
    clear
    read -p "Insert your Windows installation disk and press a key to continue" disco
    sudo mount -t auto /dev/cdrom /mnt/cdrom
    dosemu

    is this right ?

  6. #6
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    I don't know what you want to achieve.

    I wonder if you meant exit 0 as in exit zero, not o.

    Try it and find out.

  7. #7
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    For openers, /etc/rc.local is directory.
    Define your shell scripts appropriately and save them there.
    They get executed in the order presented in the directory.

    You have here a melange of things (in post #5)
    that would surprise me if it did anything useful as it stands.
    Perhaps 'try it and find out' is a bit premature.

    In regards to I/O re-direction, of any sort, I can't help you.

    I think you will get more help from some quarter if you
    define in words, more than a short sentence just what you hope to achieve.

  8. #8
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    post #7 got past me with the darn ten minute edit rule

    wrong

    /etc/rc.local is an executable script itself.
    your can reference other scripts in it.

    Best to keep things small and separate.

    Remainder of my post #7 about right, I think.

  9. #9
    Junior Member registered user
    Join Date
    Mar 2009
    Posts
    17
    I copied script.sh inside /etc/

    #!/bin/sh

    clear
    read -p "Insert your Windows installation disk and press a key to continue" disco
    sudo mount -t auto /dev/cdrom /mnt/cdrom
    dosemu

    I call it inside the /etc/rc.local file :

    rc.local

    ....
    /etc/script.sh

    I made it executable,with chmod +x script.sh

    and at the end I re-booted Knoppix with runlevel 2,but when it has finished to be loaded in memory,the script.sh is not started.

  10. #10
    Senior Member registered user
    Join Date
    Feb 2010
    Posts
    198
    Since you made it executable it is better to remove the .sh extension and place your script in /usr/sbin, then make a line in /etc/rc.local
    Make sure again it is chmod 755

    rc.local is the last script executed at every runlevel 2,3,4 and 5

Page 1 of 2 12 LastLast

Posting Permissions

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


Dell PowerEdge R720 Server - 2x8c CPU,256Gb RAM, 128Gb SSD/3x900Gb SAS, Proxmox picture

Dell PowerEdge R720 Server - 2x8c CPU,256Gb RAM, 128Gb SSD/3x900Gb SAS, Proxmox

$340.00



DELL PowerEdge R730XD 24x 2.5

DELL PowerEdge R730XD 24x 2.5" Server Dual 750W Dual Heatsink - BareBones TESTED

$269.99



Supermicro 4U 36 Bay Storage Server 2.4Ghz 8-C 128GB 1x1280W Rails TrueNAS ZFS picture

Supermicro 4U 36 Bay Storage Server 2.4Ghz 8-C 128GB 1x1280W Rails TrueNAS ZFS

$712.98



Dell Poweredge R640 Server | 2x Xeon Gold 6132 | 128GB | H730P | 8x HDD Trays picture

Dell Poweredge R640 Server | 2x Xeon Gold 6132 | 128GB | H730P | 8x HDD Trays

$1849.00



DELL PowerEdge R730 Server 2x E5-2690v3 2.6GHz =24 Cores 32GB H730 4xRJ45 picture

DELL PowerEdge R730 Server 2x E5-2690v3 2.6GHz =24 Cores 32GB H730 4xRJ45

$274.00



Dell PowerEdge R730XD 28 Core Server 2X Xeon E5-2680 V4 H730 128GB RAM No HDD picture

Dell PowerEdge R730XD 28 Core Server 2X Xeon E5-2680 V4 H730 128GB RAM No HDD

$389.99



Dell PowerEdge R620 Server 2x E5-2660 v1 2.2GHz 16 Cores 256GB RAM 2x 300GB HDD picture

Dell PowerEdge R620 Server 2x E5-2660 v1 2.2GHz 16 Cores 256GB RAM 2x 300GB HDD

$79.19



Dell PowerEdge R720XD Xeon E5-2680 V2 2.8GHz 20 Cores 256GB RAM 12x4TB picture

Dell PowerEdge R720XD Xeon E5-2680 V2 2.8GHz 20 Cores 256GB RAM 12x4TB

$510.00



1U Supermicro Server 10 Bay 2x Intel Xeon 3.3Ghz 8C 128GB RAM 480GB SSD 2x 10GBE picture

1U Supermicro Server 10 Bay 2x Intel Xeon 3.3Ghz 8C 128GB RAM 480GB SSD 2x 10GBE

$297.00



Dell Poweredge R730xd 2.5in 2x E5-2690 v3 2.6ghz 24-Cores  64gb  H730  2x 750w picture

Dell Poweredge R730xd 2.5in 2x E5-2690 v3 2.6ghz 24-Cores 64gb H730 2x 750w

$189.99