LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2016, 02:58 PM   #16
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by szboardstretcher View Post
Just the second line then. Leave out the #!/bin/bash -x

Still type it though.

Code:
/usr/bin/vncserver -- ':1' &
Unfortunately it gives a very strange response:
PHP Code:
pi@raspberrypi:/var/www/shellscr $ ./vnc2.sh
pi
@raspberrypi:/var/www/shellscr Couldn't start Xtightvnc; trying default font path.
Please set correct fontPath in the vncserver script.
Couldn'
t start Xtightvnc process.

Unrecognized option: --
use: 
[:<display>] [option]
-
#                   mouse acceleration (pixels)
-ac                    disable access control restrictions
-audit int             set audit trail level
-auth file             select authorization file
bc                     enable bug compatibility
....... 
 
Old 11-30-2016, 03:01 PM   #17
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,184

Rep: Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585
Progress i suppose.

remove the -- ?

Code:
/usr/bin/vncserver ':1' &
 
1 members found this post helpful.
Old 11-30-2016, 03:11 PM   #18
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Progress i suppose.

remove the -- ?

Code:
/usr/bin/vncserver ':1' &
Wow! Thank you! That worked! :-)
Can you explain to me your code?
 
Old 11-30-2016, 03:13 PM   #19
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,184

Rep: Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585Reputation: 1585
Anytime.

It was Shadow_7 that suggested it. I just followed the errors until it worked.

But essentially, it calls out the program, says to use display ':1', and puts it into the background with &.
 
1 members found this post helpful.
Old 11-30-2016, 03:20 PM   #20
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Anytime.

It was Shadow_7 that suggested it. I just followed the errors until it worked.

But essentially, it calls out the program, says to use display ':1', and puts it into the background with &.
Thank you very much! Made my day! :-)
 
Old 11-30-2016, 03:40 PM   #21
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,683

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
The problem is that vncserver requires local access to a virtual console. logging in over ssh doesn't give you that.

To get around that you might try the solution in:
http://www.cl.cam.ac.uk/research/dtg...nc/sshvnc.html

Doesn't mean it will work for you, but you have to forward the vnc protocol to something to interpret it... a vnc server. (I think I got that right, the page includes a "vncvewer" in some of its operation)

Last edited by jpollard; 11-30-2016 at 03:43 PM.
 
Old 11-30-2016, 04:18 PM   #22
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
The problem is that vncserver requires local access to a virtual console. logging in over ssh doesn't give you that.

To get around that you might try the solution in:
http://www.cl.cam.ac.uk/research/dtg...nc/sshvnc.html

Doesn't mean it will work for you, but you have to forward the vnc protocol to something to interpret it... a vnc server. (I think I got that right, the page includes a "vncvewer" in some of its operation)
The solution from szboardstretcher works over ssh though. Even www-data can execute that shell script successfully now. So my problem is solved.
 
Old 12-01-2016, 01:40 PM   #23
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,834
Blog Entries: 1

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
The -- tells the shell to stop interpreting past that --. Which would put the '' in question. The '' is basically dropped by the shell before it gets to vncserver when it is interpreted.

vncserver -- :1 &

should also work (in theory).
 
Old 12-01-2016, 02:51 PM   #24
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Shadow_7 View Post
The -- tells the shell to stop interpreting past that --. Which would put the '' in question. The '' is basically dropped by the shell before it gets to vncserver when it is interpreted.

vncserver -- :1 &

should also work (in theory).
When everything past that -- isn't interpreted, where's the point to write something past it then? Don't understand unfortunately.

Both versions don't work fot me by the way. It says "Unrecognized option: --".
 
Old 12-02-2016, 09:22 PM   #25
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,834
Blog Entries: 1

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
When things fail it's normally logged somewhere with some details that might hint as to WHY it's failing. YMMV

$ dmesg
$ journalctl -a
# less /var/log/syslog
# egrep -r -i vncserver /var/log/*
$ egrep -r -i vncserver ~/\.*
 
Old 12-02-2016, 09:43 PM   #26
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,834
Blog Entries: 1

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by markplus View Post
When everything past that -- isn't interpreted, where's the point to write something past it then? Don't understand unfortunately.

Both versions don't work fot me by the way. It says "Unrecognized option: --".
It's a shell thing. The shell tends to interpret the parameters BEFORE it passes the parameters. Doubly odd since the -- should have been stripped off by the shell, aka interpreted and not passed. Which implies that $(vncserver -- :1) isn't being run in a "shell script". Did you leave out the shebang? #!/bin/bash. Not that it matters, if it doesn't work leaving it out would be the saner thing to do.

I should probably test things, but I don't use vncserver. At least not in the past ten years. X2go, ssh with X forwarding and other routes to do roughly the same thing these days. Not that I've used any of those either. But I do like dividing my screen real-estate up with Xephyr to stack it vertically with Xdmx, so I can fit hundreds of lines of code on screen without needing multiple screens. Or fit the entire output of top on screen in our bloated systemd world.
 
Old 12-03-2016, 05:31 AM   #27
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,683

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
The shell always interprets the entire line.

the "--" is evaluated as well as anything following it, then all of the results are passed to the application.

How the "--" is handled by the application is up to the application itself. It is USUALLY used to indicate parameters that are to be passed to yet another application, an not used by the base application. This is why the "startx" application uses it. The parameters following the "--" are passed to the X server.
 
Old 12-03-2016, 07:52 AM   #28
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Shadow_7 View Post
It's a shell thing. The shell tends to interpret the parameters BEFORE it passes the parameters. Doubly odd since the -- should have been stripped off by the shell, aka interpreted and not passed. Which implies that $(vncserver -- :1) isn't being run in a "shell script". Did you leave out the shebang? #!/bin/bash. Not that it matters, if it doesn't work leaving it out would be the saner thing to do.
The -- doesn't seem to get interpreted by the shell. There's no difference if I put "#!/bin/bash" on the first line of the shell script or not. The -- is always being passed with the rest of the command. It always results in "Unrecognized option: --".
 
Old 12-03-2016, 08:01 AM   #29
markplus
LQ Newbie
 
Registered: Nov 2016
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Shadow_7 View Post
When things fail it's normally logged somewhere with some details that might hint as to WHY it's failing. YMMV

$ dmesg
$ journalctl -a
# less /var/log/syslog
# egrep -r -i vncserver /var/log/*
$ egrep -r -i vncserver ~/\.*
Tried all of those. Unfortunately didn't find any useful information.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail runs from command line, not from shell script jackelliott Linux - General 10 03-19-2015 08:18 AM
[SOLVED] there is one name 4 for command-line-parameters in shell script miillerje Linux - Newbie 3 10-21-2012 07:25 AM
How to pass command line arguments from one shell script to another shell script VijayaRaghavanLakshman Linux - Newbie 5 01-20-2012 09:12 PM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 09:44 AM


All times are GMT -5. The time now is 05:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration