Differences between revisions 4 and 5
Revision 4 as of 2010-03-18 15:11:06
Size: 2730
Editor: ahasenack
Comment:
Revision 5 as of 2010-03-18 15:12:11
Size: 2731
Editor: ahasenack
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
To ssh in, you just need to be on '''hostname.of.server''' and use ''ssh -p 2048 localhost' To ssh in, you just need to be on '''hostname.of.server''' and use ''ssh -p 2048 localhost''

Example Scripts for sending to Landscape clients

Initiate an SSH tunnel

You will need SSH key authentication between your client machine, and the remote machine you have access to in order for this to work.

ssh -R 2048:localhost:22 hostname.of.server

This creates a reverse tunnel on hostname.of.server at port 2048 which will tunnel back to the Landscape client machine.

To ssh in, you just need to be on hostname.of.server and use ssh -p 2048 localhost

Startup script to install Wordpress

This script can be used as a Cloud Instance startup script, i.e., use it in the page where you create new Cloud instances. It will install and configure a Wordpress blog at server.example.com/blog, where server.example.com is the hostname of the cloud instance where the script is being run.

Remember that you need to open the web port (80/tcp) to be able to access the Wordpress installation after it finishes. You may want to restrict the access to it, because the default installation will create an admin account on the first access it gets.

Here is the script:

SMART=/usr/share/smart/smart
export DEBIAN_FRONTEND="noninteractive"
export APT_LISTCHANGES_FRONTEND="none"
API_VERSION="2008-02-01"
METADATA_URL="http://169.254.169.254/$API_VERSION/meta-data"
CURL="/usr/bin/curl"

function metadata_get() {
    echo "Obtaining metadata $1" >&2
    $CURL -s $METADATA_URL/$1
    if [ "$?" -ne "0" ]; then
        echo "ERROR obtaining metadata $1"
        exit 1
    fi
    return 0
}

$SMART update
# one more time to get by the weird bug about missing the key for a channel
$SMART update
$SMART install --yes wordpress mysql-server apache2-mpm-prefork php5 php5-mysql libapache2-mod-php5 curl

fqdn=$(metadata_get public-hostname)
echo "Got hostname=$fqdn"
cat > /etc/apache2/conf.d/wordpress <<EOF
Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
</Directory>
EOF

/etc/init.d/mysql restart

bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress $fqdn

/etc/init.d/apache2 restart

Display a note in the desktop

The script below works on Ubuntu Desktop installations and can be used to display a note to the user. Just remember to run it as the same user as the one who is currently logged in on that desktop.

export DISPLAY=:0 
# display note for 30s
notify-send -t 30000 "Hello from the Landscape Webinar"

RunningScripts/ExampleScripts (last edited 2010-06-07 22:38:55 by ahasenack)