Results 1 to 4 of 4

Thread: Quick scripting question

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    3

    Quick scripting question

    Hey,
    I'm trying to setup Knoppix on USB with a few servers running on boot. I've googled the hell out of this and have found many ways of doing it, but only Knoppix.sh seems like it has a chance of working. At this point I think I must be asking the wrong questions.

    At any rate my knoppix.sh has the following code:

    /etc/init.d/ssh start
    /etc/init.d/webmin start
    /etc/init.d/mysql start
    /etc/init.d/apache2 start

    The output is:

    Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}.
    Usage: /etc/init.d/webmin { start | stop | restart }
    Usage: /UNIONFS/etc/init.d/mysql start|stop|restart|reload|force-reload|status
    Usage: /etc/init.d/apache2 {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}.

    Why is it not seeing the 'start' at the end?

    Thanks,
    --Yel

  2. #2
    Senior Member registered user
    Join Date
    Feb 2010
    Posts
    512
    I can't see any error in your /mnt-system/KNOPPIX/knoppix.sh. I tried this myself with /etc/init.d/ssh start and everything worked fine. How did you create that file? What version of Knoppix do you use?

    However I would place all services I like to start during boot in the file /etc/rc.local.

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    3

    Solved

    SOLVED

    I created knoppix.sh with notepad in Windows. This caused hidden characters to be generated.

    Quote Originally Posted by asmoore82(@Ubuntu forums)
    Was your script created or edited with a DOS text editor?

    Check these and compare the results:
    Code:
    file <your_script>
    cat <your_script>
    cat -A <your_script>
    Quote Originally Posted by YouEatLard
    It's all done with vi.

    The results from above:

    Code:
    # file knoppix.sh
    knoppix.sh: Bourne-Again shell script text executable
     
    # cat knoppix.sh
    #!/bin/bash
    /etc/init.d/ssh start
    /etc/init.d/webmin start
    /etc/init.d/mysql start
    /etc/init.d/apache2 start
     
    # cat -A knoppix.sh
    #!/bin/bash^M$
    /etc/init.d/ssh start^M$
    /etc/init.d/webmin start^M$
    /etc/init.d/mysql start^M$
    /etc/init.d/apache2 start^M$
    ^M$
    Quote Originally Posted by asmoore82(@Ubuntu)
    Yep, you've got a script with DOS newlines (see http://en.wikipedia.org/wiki/CRLF).

    That's why all those ^M's show up when you `cat -A`.
    vi doesn't create these files by default but if you open one
    for editing, vi will go with the flow.

    Strip out the extraneous Carriage Returns (0x0d) like this:
    Code:
    mv knoppix.sh knoppix.sh.CRLF
    cat knoppix.sh.CRLF | tr -d '\r' > knoppix.sh

  4. #4
    Junior Member
    Join Date
    Jan 2011
    Posts
    3
    Quote Originally Posted by klaus2008 View Post
    I can't see any error in your /mnt-system/KNOPPIX/knoppix.sh. I tried this myself with /etc/init.d/ssh start and everything worked fine. How did you create that file? What version of Knoppix do you use?

    However I would place all services I like to start during boot in the file /etc/rc.local.
    I'm using Knoppix 6.4.3 on flashdrive with a persistent image. I'd love to do it the "correct" way, but have had issues getting it to work.
    Tried init-rc.d, webmin, and 3 other ways, but none of them worked even if the text I added persisted through the reboot. I'm obviously missing something here, but I don't know what. For now, it works.

    However, I don't remember if I added the lines to rc.local. Not sure how I missed that. Thanks for the info. I'll need it soon enough.

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 R630 2x Xeon E5-2680 v4 2.4ghz 28-Cores / 128gb / H330 / 2x 1TB picture

Dell Poweredge R630 2x Xeon E5-2680 v4 2.4ghz 28-Cores / 128gb / H330 / 2x 1TB

$294.99



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

$273.00



DELL PowerEdge R730 Server 2x E5-2640v4 2.4GHz =20 Cores 32GB H730 4xRJ45 picture

DELL PowerEdge R730 Server 2x E5-2640v4 2.4GHz =20 Cores 32GB H730 4xRJ45

$259.00



Dell PowerEdge R430 3.5 1U 2x E5-2690 v3 2.6ghz 24-Cores 256gb 4x Trays 2x 550w picture

Dell PowerEdge R430 3.5 1U 2x E5-2690 v3 2.6ghz 24-Cores 256gb 4x Trays 2x 550w

$359.99



Dell PowerEdge R630 Server 2x E5-2680 V4 = 28 Cores S130 32GB RAM NEW 480GB SSD picture

Dell PowerEdge R630 Server 2x E5-2680 V4 = 28 Cores S130 32GB RAM NEW 480GB SSD

$208.99



Dell PowerEdge R420 Dual Intel Xeon E5-2440 v2 @1.90GHz 32GB RAM No HDD H710 picture

Dell PowerEdge R420 Dual Intel Xeon E5-2440 v2 @1.90GHz 32GB RAM No HDD H710

$74.50



Dell PowerEdge R620 Server 2x E5-2660 v2 2.2GHz 20 Cores 256GB RAM 1x 480GB SSD picture

Dell PowerEdge R620 Server 2x E5-2660 v2 2.2GHz 20 Cores 256GB RAM 1x 480GB SSD

$139.99



Dell PowerEdge R620 Server - 256GB RAM, 2x8cCPU, 120Gb SSD/3x900Gb SAS, Proxmox picture

Dell PowerEdge R620 Server - 256GB RAM, 2x8cCPU, 120Gb SSD/3x900Gb SAS, Proxmox

$320.00



Dell PowerEdge R630 Server Barebone with Motherboard 2 x Heat Sink 2 x 750W PSU picture

Dell PowerEdge R630 Server Barebone with Motherboard 2 x Heat Sink 2 x 750W PSU

$149.99



Dell Poweredge R720 2x Xeon E5-2670 v2 2.5GHz 20-Cores / 128gb / 600gb / H710 picture

Dell Poweredge R720 2x Xeon E5-2670 v2 2.5GHz 20-Cores / 128gb / 600gb / H710

$249.99