Tiny Core Linux
Tiny Core Base => CorePlus => Topic started by: okanagansage on February 06, 2015, 02:54:49 AM
-
Hello, I'm trying to set-up a wyse V10L as a headless machine with python's SimpleHTTPServer running automatically at boot. I'm trying to set this up for a local electronics recycling depot. I'm going to attach a dedicated wireless router to the side of it so they can easily just plug it in (and the router) to share files with customers who're on site (tutorials and documents on repurposing pc's, etc). I have no experience with web servers.
The wyse is running tinycore off of a live-usb that I made using a coreplus cd on a laptop. The live-usb is sdb since the internal drive has not been touched. I've installed openssh and configured it to autostart for administration purposes. That involved editing /opt/bootlocal.sh and /opt/.filetool.lst . After reboot, openssh autostarts fine.
I figure I could get the SimpleHTTPServer running the same way by adding 'cd /home/Documents && python -m SimpleHTTPServer' to /opt/bootlocal.sh and adding lines to /opt/.filetool.lst ... but I don't know what lines to add to .filetool.lst. I've got the 'locate' command by installing findutils but I get no results by searching for SimpleHTTPServer. On lubuntu I can use locate to find /usr/lib/python2.7/SimpleHTTPServer.py but on tinycore I get nothing. Even if I try to locate just python there is no output. I've manually gone through a bunch of directories to find SimpleHTTPServer.py but have had no luck.
If anyone could point me in the right direction it would be greatly appreciated.
Paul
Edit: It's midnight now so I'm gonna crash but I'll keep keep an eye out for replies.
-
to locate files created after you do something, load the findutils extension and:
$ touch mymarker
$ do something
$ sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | grep -v "^\/sys\/" | tee files
$ vi files
-
If you just need a web server, you'll save tens of megabytes by using busybox-httpd instead of python.
-
Hi okanagansage
Are you sure you installed python.tcz?
On lubuntu I can use locate to find /usr/lib/python2.7/SimpleHTTPServer.py but on tinycore I get nothing.
On Tinycore it would be under:
usr/local/lib/python2.7/SimpleHTTPServer.py
-
@Rich:
When I look in:
apps (program) > apps (button) > maintenance > onboot maintenance
python.tcz is in the list.
In /usr/local/lib there is no python files/folders, but in /usr/local/tce.installed there is a file called python with the contents:
#!/bin/sh
tar xzf /usr/local/share/python/files/files.tar.gz -C /
ln -sf /usr/local/bin/python2.7 /usr/bin/python
I'm just going to see if I understand this. Python is being extracted, then a link is being created between the files /usr/local/bin/python2.7 and /usr/bin/python .
If I look in /usr/local/bin I can see python2.7 and it's text is in green where the vast majority of other files in there have blue-ish green text. I'm guessing the green text indicates that the file itself is linked to a file elsewhere.
So at this point python is only running when I run the command in the terminal, right? My question is how do I get SimpleHTTPServer to start on boot and serve whatever I have in ~/Documents ?
.........................................................
In /opt/bootlocal.sh I have just the line for openssh:
/usr/local/etc/init.d/openssh start
In /opt/.filetool.lst I have:
opt
home
etc/shadow
usr/local/etc/ssh/ssh_config
usr/local/etc/ssh/sshd_config
...........................................................
@curaga
I was trying to use SimpleHTTPServer because it is the only 'server' I've ever used. It serves access to the folder of my choosing without me having to know any html or whatever. Like I said in my original post, I have practically no experience with servers. I have a little experience with linux but very little experience with tinycore.
...................................................
@juanito
I tried your find command with SimpleHTTPServer instead of mymarker and I get 'no such file or directory'.
-
I'm going to try to wrap my head around this (I've been reading this:
http://www.parkytowers.me.uk/thin/Linux/TinycoreWS.shtml (http://www.parkytowers.me.uk/thin/Linux/TinycoreWS.shtml)
When tinycore boots, it looks in attached storage for the tce directory which contains any option extensions I've installed. Those extensions on the storage medium are actually compressed storage file systems. So in
/mnt/sdb2/tce/optional/
it is finding python.tcz and python.tcz.dep and python.tcz.md5.txt ...
Then it mounts python.tcz at /tmp/tmloop/python
So if I go to
/tmp/tcloop/python/usr/local/lib/
I find two files and a folder:
libpython2.7.so libpython2.7.so.1.0 python2.7/
AND IN python2.7/ IS >>> SimpleHTTPServer.py
I don't know why the command
sudo locate SimpleHTTPServer
or
sudo locate SimpleHTTPServer.py
does not find these files. Maybe it doesn't search in /tmp .
So...
/mnt/sdb2/tce/optional/python.tcz
is mounted to
/tmp/tcloop/python/
and that tmp directory is merged into the main system.
That means
/tmp/tcloop/python/usr/local/lib/python2.7/
is also located at
/usr/local/lib/python2.7/
Which it is.
I think I've just about got this.
I'm going to read a bit more and I'll post what I find.
Edit: That's weird. When I replied to Rich in the previous post I said that python wasn't in /usr/local/lib/
If it was installed as an onboot program, shouldn't it be there even before running the following command?
python -m SimpleHTTPServer
-
So it turns out that just adding
python -m SimpleHTTPServer
to /opt/bootlocal.sh works but if I try adding this to /opt/bootlocal.sh:
cd Documents && python -m SimpleHTTPServer
it doesn't work.
Either does
cd /home/tc/Documents && python -m SimpleHTTPServer
-
You can record the error messages:
cd /home/tc/Documents && python -m SimpleHTTPServer > /tmp/pyerr 2>&1
-
Maybe I misunderstand the issue, but there are no such thing as SimpleHTTPServer you can start. It is a Python modul what you can use to include SimpleHTTPServer to an application. You can start this apllication, but not SimpleHTTPServer. Pelase see
https://docs.python.org/2.7/library/simplehttpserver.html#module-SimpleHTTPServer
-
Thanks for your suggestions. I've got this working at boot so I'm going to consider this solved.
I want to bring this wyse into the recycling depot soon and I still want to try out some command line music players.
Thanks again.
Paul