[webshell] Command line access from web browser

prpr

Well-Known Member
#21
Is Webshell supposed to work on the HD? It installs OK but when you attempt to access it, it gives an error message and then returns to the main menu, but within what would have been the command line window area, so you get a kind of cascade effect.

Hmm, just tried enabling maintenance mode from the Webif and rebooting and got a shell window in the browser, so it does work. The first bit must be an error then.

Edit: Forget that. It must have needed a reboot, 'cos it's working now.
 

prpr

Well-Known Member
#22
Ah, I remember this now, you have a custom profile script to launch the /mod version of the shell with more capabilities.
I suppose this would be more elegant:
Code:
if [ "`echo $0 | cut -d/ -f4`" = busybox ]; then
        export HOME=/mod
        export PS1="\[\033[01;32m\]\h\[\033[01;34m\] \w \# \[\033[00m\]"
else
        [ -x /mod/bin/busybox/sh ] && exec /mod/bin/busybox/sh -l
fi
I guess I still need the bits that were there before. This is how I have it now and seems to work:
Code:
if [ "`echo $0 | cut -d/ -f4`" = busybox ]; then
  # Things to run in the better shell only.
  export PS1="\[\033[01;32m\]\h\[\033[01;34m\] \w \# \[\033[00m\]"
  export SHELL=/mod/bin/busybox/sh
else
  # If in the default login shell and the better one is available, then...
  if [ ! -f /tmp/maintenance.boot.log ]; then
  [ -x /mod/bin/busybox/sh ] && exec /mod/bin/busybox/sh -l
  fi
fi
The HOME setting seems to be superfluous and wasn't include in previous discussions.
 
Last edited:

Black Hole

May contain traces of nut
#24
Excellent. My HDR4 (with webshell installed) and on the latest beta test 3.10 firmware selected maintenance mode and then rebooted from the diagnostics page, and went straight into a command session, all in the web browser. Very nice, and loads more convenient than breaking out a Telnet client.
 

Black Hole

May contain traces of nut
#26
What is it about a Webshell session that causes it to time out if the relevant browser window isn't actively being viewed for a period? This happens both in iOS11/Safari and Win7/Chrome. I'm not closing the browser window, just taking focus away from it, but somehow the Webshell session "knows" and aborts whatever it might be doing at the time. It's a pain.

Are there any tweaks that could be made to Webshell to stop this happening and keep the session persistent?
 
OP
OP
af123

af123

Administrator
Staff member
#27
It's probably the browser end. There has been a push to reduce CPU usage for unfocussed stuff recently.
 

Black Hole

May contain traces of nut
#29
It's probably the browser end. There has been a push to reduce CPU usage for unfocussed stuff recently.
Why? What causes it?

Are browser window refreshes fetched rather than pushed? If so, how do live updating web pages work?

If fetched, the webshell end must be detecting that there hasn't been any fetches for a while, and terminating. Can't it be stopped from terminating?

If pushed, the webshell end must be detecting that the pushes aren't being rendered, and terminating. Again, can't it be stopped?

Other WebIF operations don't terminate just because you're not watching them. Okay, so it might be necessary to detect a no-response from the browser to terminate an orphaned session, but make the timeout longer, or if there is an existing session when webshell is launched, ask the user if they want to open a new session or reconnect to an existing one. Yes, I know that sounds a lot like abduco - can't that be used to manage webshell?
 

Black Hole

May contain traces of nut
#30
A little annoyance: using webshell on iOS/Safari, the shift key becomes sticky when it wouldn't normally be (normally: click shift once for a single-character shift, click twice to shift-lock; in webshell: clicking shift toggles shift-lock).

This is not a problem in itself, but when one is not used to shift acting as shift-lock...
 

prpr

Well-Known Member
#31
Interesting...
/mod/boot/xinit.d/webshell is missing on all 4 of the HDRs I look after and on my HD.
Obviously it stops Webshell working (edit: in Maintenance Mode).
I wonder what can have caused this?

No other packages are broken.
 
Last edited:
#33
Interesting...
/mod/boot/xinit.d/webshell is missing on all 4 of the HDRs I look after and on my HD.
Obviously it stops Webshell working.
I wonder what can have caused this?

No other packages are broken.
Webshell is working fine, but the file is missing
Code:
ls /mod/boot/xinit.d/webshell                                                                         
cannot access /mod/boot/xini/mod/boot/xinit.d/webshell: No such file or directory
Package listing
Code:
opkg files webshell
Package webshell (1.0.3) is installed on root and has the following files:                                                                         
/mod/etc/lighttpd/extra.d/webshell.conf                                                                                                             
/mod/boot/2/webshell/shellinaboxd                                                                                                                   
/mod/etc/modservice.d/webshell                                                                                                                     
/mod/webif/plugin/webshell/style.css                                                                                                               
/mod/webif/plugin/webshell/vt100.css                                                                                                               
/mod/boot/2/webshell/libutil.so.0                                                                                                                   
/mod/etc/init.d/S85webshell                                                                                                                         
/mod/boot/xinit.d/webshell                                                                                                                         
/mod/webif/plugin/webshell/index.jim                                                                                                               
/mod/webif/plugin/webshell/diag.hook                                                                                                               
/mod/webif/plugin/webshell/icon.png
 

Black Hole

May contain traces of nut
#37
Hmm.

Code:
HDRFOX1# ls /mod/boot/xinit.d/
ahw*             install_dustbin* install_ir3*     opkg-beta*       tunefix*         xdso*
dbupdate*        install_fan*     install_nugget*  rsvsync*         vdisk*           xota*
HDRFOX1#
Code:
HDRFOX3# ls /mod/boot/xinit.d/
ahw*             install_dustbin* install_ir3*     opkg-beta*       tunefix*         xdso*
dbupdate*        install_fan*     install_nugget*  rsvsync*         vdisk*           xota*
HDRFOX3#
Code:
HDRFOX4# ls /mod/boot/xinit.d/
ahw              install_dustbin  install_ir3      multimode        rsvsync          vdisk            xota
dbupdate         install_fan      install_nugget   opkg-beta        tunefix          xdso
HDRFOX4#
I have no idea why HDR4 looks different from the other two.
 
OP
OP
af123

af123

Administrator
Staff member
#38
I have no idea why HDR4 looks different from the other two.
At a guess, it has the multimode package installed.
The lack of asterisks after the filenames is due to the shell environment (specifically the alias you have for ls) - I don't know why that's different.
 
OP
OP
af123

af123

Administrator
Staff member
#40
That much hadn't escaped me! Multimode on that machine because I use it for radio.
So was it the asterisks you were puzzling over? They're shown if the ls command is using the -F flag to indicate a file which is executable - if you type alias at the command line, do you see a difference there for ls?
 
Last edited:
Top