![]() |
Share your shell scripts
Probably quite a few of us have created shell scripts for our N9's to help with different tasks and to increase usability of our devices. Idea of this thread is to share what you have in your ~/bin and maybe some people will find these scripts useful and/or can improve on them.
|
Re: Share your shell scripts
I'll start with a script called "httpshare" which I made to ease sharing files on my N9. It's basically just a helper script for Python's SimpleHTTPServer, but I've found it very useful when I need to quickly access contents of my N9 from another device.
See/Get it here. Screenshots for impatient: http://www.saunalahti.fi/ladoga/harm...httpshare1.jpg http://www.saunalahti.fi/ladoga/harm...httpshare2.jpg Installation: It depends on python so you need to: Code:
# apt-get install python Code:
$ chmod 755 ~/bin/httpshare Code:
$ httpshare . If you want to access the server from WAN (internet) remember to set your router's port forwarding accordingly. On a mobile "broadband" (2G/3G) it's possible that your ISP uses NAT for IP addresses (your device doesn't have a public IP address) or the port 80 (http) for incoming traffic is blocked. In latter case you might be able to get through using some other port. (set the value of port variable in the script accordingly). Known issues: -Python SimpleHTTPServer will spit out some garbage on keyboard interrupt (Ctrl+c). This is harmless other than aesthetically. I didn't find a good way to remove the garbage as it seems to lump almost all of it's output into stderr and thus sending 2 > /dev/null will also get rid of useful output, such as info on incoming connections. If you nonetheless want to make it quiet you can redirect all it's output to /dev/null by replacing the line: Code:
develsh -c "python -m SimpleHTTPServer $port > /dev/null" Code:
develsh -c "python -m SimpleHTTPServer $port > /dev/null 2>&1" PS. Code tags on TMO don't work (wrapping of lines), otherwise I would have posted the script into message itself. |
Re: Share your shell scripts
Nice script and can be useful. Thanks.
|
Re: Share your shell scripts
I have a question.. Instead exiting with Pressing "Ctrl" + c how I can exit with command ?
|
Re: Share your shell scripts
Quote:
Code:
$ ps -Af | grep HTTP Code:
$ kill [PID] Code:
$ pid=`pgrep -f HTTP`; kill $pid |
Re: Share your shell scripts
Tell me please if this ok to add this into N9QT ?
Thanks |
Re: Share your shell scripts
Sure, you can use it as you wish.
|
Re: Share your shell scripts
I would like to present my new years' gift from thedead 1440 - a desktop toggle for LPM/standby sreen.
Basically its just 2 icons, 1 sh file and 1 .desktop file, but he even made a .deb for it! :cool: All files are here so feel free to modify if requried. The regarding thread is here, better icons can be found here or here. Enjoy. :) |
Re: Share your shell scripts
ladoga, can you help me to create a simple script that can check if SimpleHTTPServer runs or not and if it is running -> command to close, if not running -> start this "httpshare ~/MyDocs/Movies"
I want to create desktop icon for this: 1. one click = check if SimpleHTTPServer run or not and if it is runing -> command to close. 2. second click = check if SimpleHTTPServer run or not and if it is NOT run -> start this "httpshare ~/MyDocs/Movies" Thanks |
Re: Share your shell scripts
@Schturman
In above post there was all you needed to know. Code:
#!/bin/sh |
All times are GMT. The time now is 20:45. |
vBulletin® Version 3.8.8