Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2010-03-18 15:11:06
Size: 2730
Editor: ahasenack
Revision 6 as of 2010-06-07 12:25:43
Size: 2670
Editor: ahasenack
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''
Line 41: Line 41:
$SMART update
# one more time to get by the weird bug about missing the key for a channel
mkdir -p -m 0700 /root/.gnupg

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:

export DEBIAN_FRONTEND="noninteractive"

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

mkdir -p -m 0700 /root/.gnupg
$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

/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)