Active Topics

 



Notices


Reply
Thread Tools
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#1
hey guys, I have a small question and I'm hoping someone can help me....

I do not know how much battery ssh server consumes but since some people opened a couple of threads I guess it may play a significant role in its duration.

I was thinking of finding a way to boot the n900 with the ssh server stopped and then have it started only when I connect to the internet and stopped again when I disconnect.

I do not know if this could be possible, I am not a guru on that stuff, but what if we could put 2 scripts in

/etc/network/if-up.d and
/etc/network/if-down.d
respectively.


Would this work?

Thanks in advance
 
Posts: 490 | Thanked: 191 times | Joined on May 2010
#2
Should work. Try it
put

into /etc/network/if-down.d

#!/bin/sh
/etc/init.d/sshd stop

into /etc/network/if-up.d

#!/bin/sh
/etc/init.d/sshd start

[added]remove sudo
[added] ok it doesn't work. :S

Last edited by aligatro; 2010-11-04 at 17:42.
 

The Following User Says Thank You to aligatro For This Useful Post:
ToJa92's Avatar
Posts: 1,091 | Thanked: 323 times | Joined on Feb 2010 @ ~
#3
Otherwise there's a statusbar applet which let you stop/start the SSH server. Can't remember its name.
 
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#4
Thanks! I'll give it a try later today and post the results!

BTW: Will sudo work? Shouldn't I just create the file as root?

Last edited by colder; 2010-11-04 at 16:48.
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#5
oo interested in this for a few ways!
After a reboot i always forget to turn it back on! doh - and on connecting to wifi it would be great!
Also - how much power would it being on actually use? (Or more realistically does it poll something? if so how often etc...)
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
cddiede's Avatar
Posts: 1,034 | Thanked: 784 times | Joined on Dec 2007 @ Annapolis, MD
#6
I use the following upstart script to start a new VNC server everytime a new network connection is started. It dosen't deliniate between Wi-Fi and GPRS/3G, but it may be useful:

I've placed the following script (called vncs) in:

/etc/network/if-up.d

What this does is first off, starts a vnc server on the N900 whenever a network connection is established.

Secondly, it will kill any vnc server that is already running so you don't end up with a boatload of vnc server processes running if you connect to several networks throughout the day.

script follows:

APPCHK=$(ps aux | grep -c x11vnc)

if [ $APPCHK = '0' ];

then

/usr/bin/nohup /usr/bin/x11vnc -forever &

else

/usr/bin/pkill x11vnc;/usr/bin/nohup /usr/bin/x11vnc -forever &

fi
 

The Following User Says Thank You to cddiede For This Useful Post:
Posts: 490 | Thanked: 191 times | Joined on May 2010
#7
Originally Posted by colder View Post
Thanks! I'll give it a try later today and post the results!

BTW: Will sudo work? Shouldn't I just create the file as root?
o yea. ignore the sudo. It's used on ubuntu, because root account is inactive.
 
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#8
I personally use http://en.wikipedia.org/wiki/Inetd to launch the SSH server.

A bit harder to setup, introduces latency when connecting to it, but you need only one daemon active that _for sure_ does not use any extra CPU time. You can also use it to launch VNC server, Samba server....

OTH I'd be wary that the openssh server uses any battery, specially without a network connection. The reason I use inetd is because I run some other services that are "less tested".

Last edited by javispedro; 2010-11-04 at 17:28.
 
Posts: 12 | Thanked: 2 times | Joined on Oct 2008 @ Houston
#9
@cddiede
That's exactly what I want to end up doing, only I wanna tunnel vnc through ssh. I will try to modify your script sometime this weekend.

What I want to end up doing is create a script that, when connected, will update my dyndns.org account with the current ip and start openssh server. In the same manner, when disconnected, it will shut down openssh server for power saving.

This way I can remotely connect to the phone whenever it is connected through wifi. Another advantage (if this works right), is that it can help as a WEAK anti-theft solution; if someone steals the phone and just changes the sim card without formatting, it may be useful in recovering it.

Right?
 
Posts: 140 | Thanked: 40 times | Joined on Sep 2010
#10
i am quite interesting in this script to disable/enable the ssh depending on wifi connectivity. any updates to this thread?
 
Reply


 
Forum Jump


All times are GMT. The time now is 19:57.