[plug] VNC Shell Script

Brock Woolf ultima160 at iinet.net.au
Sun Nov 7 17:14:18 WST 2004


On 07/11/2004, at 4:14 PM, James Devenish wrote:
>  - If rfbdrake is similar to other software that requires passwords,
>    then it should have a non-GUI method of entering a password. In
>    general, methods include: specifying the name of a file that 
> contains
>    the password, or entering a password from the keyboard, or piping 
> the
>    password to 'standard input', or passing a password as a command-
>    line argument (eek). UNIX VNC servers generally accept an -rfbauth
>    command-line option with which you specify the location of a file
>    that you pre-created using the `vncpasswd` programme.
>  - I find it odd to imagine that your cron job might be opening up a 
> GUI
>    box, because cron should not be invoking your script with a $DISPLAY
>    variable.
Hmm, you made me think and i've solved one problem at least.

If i type (must be root):
DISPLAY=:0 x0rfbserver

is starts up with the password already entered, and sets up the VNC 
server which is what I was looking for.
But now the problem seems to be with my script. if i run the bash 
script from a console i get an error:

/brock_scripts/rfbserver.sh: line 8: syntax error: unexpected end of 
file

This is the complete script:

		#!/bin/sh
		if ps -auxww | grep "x0rfbserver" | grep -v grep ; then
			exit 0
		else
			DISPLAY=:0 x0rfbserver

I am a little new to bash scripting and this is my first try,
can you see any flaws in it?

- Brock ;)


>
> In message <B0A9B2E8-3092-11D9-8F16-000D936A747A at iinet.net.au>
> on Sun, Nov 07, 2004 at 03:57:37PM +0800, Brock Woolf wrote:
>> Cron tab file, so far (without the dashes):
>> */15 * * * * brock /brock_scripts/rfbdrake.sh
>
> That looks a little unusual. I don't know what you mean by "dashes", 
> but
> maybe it needs to look like this:
>
>> */15 * * * * ~brock/brock_scripts/rfbdrake.sh
>
>> And this is the "rfbdrake.sh" shell script it refers to:
>> #!/bin/sh
>> if ps -auxww | grep "x0rfbserver" | grep -v grep ; then
>> 	exit 0
>> else
>> 	rfbdrake
>
> At the very least, that shell script will require the following line
> after the 'rfbdrake' line:
>
> fi
>
> (Yes, 'fi' on its own, to balance the 'if'.)
>
> Also, try to avoid parsing the output of `ps`. Consider replacing
> "ps -auxww | grep "x0rfbserver" | grep -v grep" with
> "pgrep x0rfbserver >/dev/null" or something with `pidof`.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2409 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20041107/dd2149ea/attachment.bin>


More information about the plug mailing list