-
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
-
Senior Member
registered user
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.
-
Solved
SOLVED
I created knoppix.sh with notepad in Windows. This caused hidden characters to be generated.
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>
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$
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
-
Originally Posted by
klaus2008
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
-
Forum Rules
Lot of 10 Mixed Brand 256GB 2.5" SATA SSD HDD Solid State Hard Drive Internal
$87.99
Fanxiang SSD 512GB 1TB 2TB 4TB 2.5''SATA III Internal Solid State Hard Drive LOT
$188.09
Netac 1TB 2TB 512GB Internal SSD 2.5'' SATA III 6Gb/s Solid State Drive lot
$109.99
SAMSUNG SSD 870 EVO 1TB 500GB 250GB 2.5 inch SATA III 3 Solid State Drive US
$92.99
Patriot P210 128GB 256GB 512GB 1TB 2TB 2.5" SATA 3 6GB/s Internal SSD PC/MAC Lot
$13.99
Crucial MX500 CT250MX500SSD1 250 GB SATA III 2.5 in Solid State Drive
$14.99
Micron RealSSD C400 2.5" 512GB SATA SSD Solid State Hard Drive MTFDDAK512MAM-1K1
$24.99
Fanxiang M.2 SATA SSD 1TB 2TB 512GB 256GB NGFF M2 Internal Solid State Drive Lot
$35.99
Fanxiang 4TB 2TB 1TB SSD 550MB/s 2.5'' SATA III Internal Solid State Drive lot
$208.99
Fanxiang M.2 SATA SSD 2TB 1TB 512GB 256GB SSD Internal M2 Solid State Drive Lot
$109.99