Xvnc versus X11vnc

What is the difference between Xvnc and X11vnc?

Xvnc: Is an X and VNC server at the same time. It is mainly used to run the X server on a virtual display, (in the absence of a physical one) and connect remotely to it with a VNC client/viewer.

X11vnc: Is a vncserver that “publishes” an existing physical X display over VNC, allowing remote clients to connect with it using a VNC viewer. That is, they can see the actual running desktop windows, as if they were in front of the server.

Advertisements

Bash ‘help’

Some commands you type in the shell are actually not binaries but shell (bash for example) buitins. For example, “alias” is such an shell builtin.

~# type alias

alias is a shell builtin

~# man alias

No manual entry for alias

In order to obtain more information about the “alias” builtin, you should type “man bash” and search what you are looking for in the hundreds of pages long man.

However, there is a quicker way! “help” helps you:

~# help alias

alias: alias [-p] [name[=value] … ]

    Define or display aliases.

    Without arguments, `alias’ prints the list of aliases in the reusable

    form `alias NAME=VALUE’ on standard output.

    Otherwise, an alias is defined for each NAME whose VALUE is given.

    A trailing space in VALUE causes the next word to be checked for

    alias substitution when the alias is expanded.    

    Options:

      -p Print all defined aliases in a reusable format

    Exit Status:

    alias returns true unless a NAME is supplied for which no alias has been

    defined.

 

Execute sudo from a cron script

Recently I bumped into this problem, and I wanted to share it’s easy solution:

Say you want to execute:

0 6 * * * /home/oraias/cron/restart.sh

Contents restart.sh:

#!/bin/bash
PID=$(ps aux | grep tomcat8 | grep -v grep | tr -s ” ” | cut -d” ” -f2)
kill -9 $PID
sleep 5
sudo systemctl start tomcat8

Each day at 6AM cron launches this script. It looks up the PID of a Java process with “tomcat8” in it’s argument list. Kills the process and starts it again. Since this script is being launched as a non-root user, sudo is required for systemctl operation (assuming you configured the sudoers file).

It might happen that the last line of the script silently fails. If this is also your case, check the following options in /etc/sudoers (make sure to open it with sudoedit):

#
# Disable “ssh hostname sudo <cmd>”, because it will show the password in clear.
# You have to run “ssh -t hostname sudo <cmd>”.
#
Defaults requiretty

#
# Refuse to run if unable to disable echo on the tty. This setting should also be
# changed in order to be able to use sudo without a tty. See requiretty above.
#
Defaults !visiblepw

Since cron doesn’t launch any TTY, the above options cause sudo to fail silently.

Comment out both to change this behavior.