One of the more annoying things about performing maintenance on a server through ssh is finding out when the server is up again after a reboot. I’m constantly trying to log into the server over ssh and checking to see if it’s up. Here’s a novel idea, why don’t I figure out how to get the server to notify me when it’s up! While reading about make server beep after bootup and customizing Notify OSD notification, I got the idea to have the server send me an OSD notification using the rc.local script.
Notify OSD notifications are the small bubbles that popup in the upper right hand corner of the Ubuntu screen, just underneath the panel noticiations area. The most common OSD notification is probably the network connection notification as seen in the screenshot below.
rc.local is a file that the server runs once the server is fully booted.
The method to which the server notifies the desktop client is as follows:
- Server reboots.
- Server runs rc.local once it finishes booting.
- The rc.local sends an OSD notification through SSH telling that the server is up and running.
How to Setup Server Up Notifications
Nomenclature:
- Server – the server machine that reboots and sends to the OSD notificaton.
- Client – the desktop machine that receives the OSD notificaton.
- <client_user_name> – the username of the client computer that recieves the OSD notifications.
- <server_user_name> – the username of the server computer.
- <client_computer_name> – the name of the client computer.
- <server_computer_name> – the name of the server computer.
- <domain_name> – the name of the network domain.
Client Setup
I’m using Ubuntu Lucid 10.04 as my desktop OS.
1. Install OpenSSH server.
sudo apt-get -y --force-yes install openssh-server
Server Setup
I’m using Ubuntu Server Karmic 9.10 as my server OS.
1. Install Notify OSD.
sudo apt-get -y --force-yes install notify-osd
2. Test to see if the client will recieve the OSD notification.
ssh -X <client_user_name>@<client_computer_name>.<domain_name> 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"'
Example:
voltron43@server: ~$ ssh -X voltron43@voltron43-laptop.local 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"'
where
- “Server is up” is the notification message
- -i “/usr/share/icons/Humanity/apps/48/bash.svg” is the location of the icon on the client computer shown in the OSD notification.
Once the test is successful, we need to move onto password-less SSH logins in order for the server to send the OSD notification without having to prompt for the client username’s password. Because rc.local uses root instead of the Server superuser, we need to setup the password-less SSH login with root.
3. On the Server, switch to root user.
sudo su
4. Generate RSA keys.
ssh-keygen -t rsa
5. Accept the default file and leave the passphrase blank.
Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub.
6. Copy the RSA key to the client computer and client username.
ssh-copy-id -i /root/.ssh/id_rsa.pub <client_user_name>@<client_computer_name>.<domain_name>
Example:
ssh-copy-id -i /root/.ssh/id_rsa.pub voltron43@voltron43-laptop.local
7. Test the OSD notification from root to make sure there isn’t a password prompt.
ssh -X <client_user_name>@<client_computer_name>.<domain_name> 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"'
Example:
root@server: ~$ ssh -X voltron43@voltron43-laptop.local 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"'
8. Create the rc.local file
sudo nano /etc/init.d/local
The Ubuntu equivalent to rc.local is the local file located in the init.d folder.
9. Paste the following into the local file.
#!/bin/sh ssh -X @. 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"' exit 0
10. Save and exit nano by pressing Ctrl+O and Ctrl+X.
11. Make the local file executable.
sudo chmod +x /etc/init.d/local
12. Link the local file with Init.
sudo update-rc.d local defaults 80
13. Restart the server and you’re done!
sudo reboot
Debugging
To debug the script, add “> /home/<server_user_name>/error.log 2>&1″ to the local file at the end of the ssh command to check for errors and “echo $(date) – Running >> /home/<server_user_name>/test.run” in the next line to see if the local file is being executed on startup.
#!/bin/sh
ssh -X <client_user_name>@<client_computer_name>.<domain_name> 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"' > /home/<server_user_name>/error.log 2>&1
echo $(date) - Running >> /home/<server_user_name>/test.run
exit 0
Example:
#!/bin/sh ssh -X ssh -X voltron43@voltron43-laptop.local 'DISPLAY=:0 notify-send "Server is up" -i "/usr/share/icons/Humanity/apps/48/bash.svg"' > /home/voltron43/error.log 2>&1 echo $(date) - Running >> /home/voltron43/test.run exit
References
How to Change Dropbox’s Status Icons [HOWTO]
Ever since the release of Dropbox’s 8.0 and above experiemental builds, users have had the ability to change the application indicator icons. This is particularly handy when trying to match the new Lucid themes. Nothing is more annoying than a monochrome application indicator icons with a blue Dropbox icon in the mix. If you haven’t updated Dropbox to the latest experimental build via dbupdate, please see this post. Below is a list of icons taken from OMGUbuntu!.
Application Indicator Icons Sets for Dropbox
1. Ubuntu Dark by Incognitus
Download
2. Ubuntu Light by Incognitus
Download
3. Ubuntu Mono Dark Set 1 by nevon
Download
4. Ubuntu Mono Dark Set 2 by nevon
Download
5. Dropbox Ubuntu Mono by invernizzi
Download
6. Dropbox Notification Icons Dark by Charles Anderson
Download
7. Dropbox Notification Icons Light by Charles Anderson
Download
8. Dropbox Monochrome Dark by Joern
Download
9. Dropbox Monochrome Light by Joern
Download
How to install the icons.
There are a few ways to download and install the Dropbox icons.
Option 1: Manually download and install the icons.
1. Download the compressed archive to your home directory.
wget <archive URL> -O ~/icons.tar.gz
2. Stop Dropbox.
/usr/bin/dropbox stop
3. Backup the original Dropbox icons in the ~/.dropbox-dist/icons directory.
mkdir ~/.dropbox-dist/icons/Backup cp ~/.dropbox-dist/icons/*.png ~/.dropbox-dist/icons/Backup/
4. Extract the compressed archive and place the icons in your ~/.dropbox-dist/icons directory.
tar xvf ~/icons.tar.gz
5. Browse to the extracted directory and manually copy the icons to the ~/.dropbox-dist/icons directory.
6. Start Dropbox
/usr/bin/dropbox start
Option 2: Download and run the install_dropbox_icons script.
install_dropbox is a bash script that downloads and installs custom notification icons for Dropbox. The current supported icon sets are:
- Ubuntu Dark by Incognitus
- Ubuntu Light by Incognitus
- Ubuntu Mono Dark Set 1 by nevon
- Ubuntu Mono Dark Set 2 by nevon
- Ubuntu Mono Elementary by invernizzi
- Dropbox Notification Icons Dark by Charles Anderson
- Dropbox Notification Icons Light by Charles Anderson
- Dropbox Monochrome Dark by Joern
- Dropbox Monochrome Light by Joern
1. Download the script.
wget http://dl.dropbox.com/u/16428/scripts/install_dropbox_icons.tar.gz -O ~/install_dropbox_icons.tar.gz
2. Extract the script.
tar xvf ~/install_dropbox_icons.tar.gz
3. Make the script executable.
chmod +x ~/install_dropbox_icons
4. Run the script.
~/./install_dropbox_icons
Optional: Remove the script and archive from the home directory.
rm ~/install_dropbox_icons*
The install_dropbox_icons script can be downloaded here.
Update: install_dropbox_icons has been updated to version 0.2.
Related posts:
It’s great to have the Dropbox installed on your Ubuntu machine, but what if you want to keep it on the cutting edge? It’s possible to visit the Dropbox forums and check for the latest experimental builds everyday, but that gets very tedious and annoying. Thankfully, Dustin B. over at the Dropbox forums wrote a script/application, titled dbupdate, that automatically downloads the latest experimental build.
How to install dbupdate.
There are a few different options on how to use this script.
Option 1: Download the dbupdate script and run it as a bash script.
Note: the below code corresponds to version 2.10 of the dbupdate script and will not work with future releases. I recommend installing dbupdate via the repository (see option 3 below).
Run the following code in Terminal.
1. Download the script.
wget http://dl.dropbox.com/u/1108539/dbupdate/dbupdate0.2.10
2. Make the script executable.
chmod +x dbupdate0.2.10
3. Run the script and check is there is a Dropbox update.
./dbupdate0.2.10 -c
4. Run the script and upgrade Dropbox.
./dbupdate0.2.10 -u
Optional: The script can also be installed via the script by running the following code.
sudo ./dbupdate0.2.10 -i0
Option 2: Download and install the deb files.
Note: the below code corresponds to version 2.10 of the dbupdate-bin deb file and version 2.5 of the debupdate deb file and will not work with future releases. I recommend installing dbupdate via the repository (see option 3 below).
Run the following code in Terminal.
1. Download the deb files.
wget http://dl.dropbox.com/u/1108539/dbupdate/dbupdate-0.2.5.deb && wget http://dl.dropbox.com/u/1108539/dbupdate/dbupdate-bin-0.2.10.deb
Alternative: Download the deb files over at the Dropbox forums.
2. Install the dependencies.
sudo apt-get -y --force-yes install libnotify-bin
3. Install the deb files.
sudo dpkg -i dbupdate-bin-0.2.10.deb sudo dpkg -i dbupdate-0.2.5.deb
4. Cleanup the deb files.
rm dbupdate-0.2.5.deb && rm dbupdate-bin-0.2.10.deb
5. Proceed to Update Dropbox section below.
Option 3 (recommended): Install via the repository.
The advantage to using the repository is that the most recent version of dbupdate is installed and dbupdate is automatically updated when a new version is released.
Run the following code in Terminal.
1. Add the dbupdate repository.
echo "deb http://dl.dropbox.com/u/1108539/dbupdate ./ #dbupdate" | sudo tee -a /etc/apt/sources.list.d/dbupdate.list
2. Add the dbupdate public key.
wget --quiet http://dl.dropbox.com/u/1108539/db.asc -O- | sudo apt-key add -
3. Update the repository.
sudo apt-get update
4. Install dbupdate
sudo apt-get -y --force-yes install dbupdate
5. Proceed to Update Dropbox section below.
Update Dropbox
It’s very easy to update Dropbox using dbupdate.
Run the following code in Terminal.
1. Check if there is a Dropbox update.
dbupdate -c
2. Update dbupdate
dbupdate -u
To see a list of all of the supported dbupdate command options.
man dbupdate
or
dbupdate -h
Below is a little video of dbupdate in action.
Note: The video is a little out of date so the commands shown in the video may not work with the current version of dbupdate.
One of the latest updates to Dropbox is the introduction of custom status icons. A future HOWTO post will outline how to download and install custom status icons.
How to Install Dropbox in Ubuntu [HOWTO]
One of my favorite applications is the proprietary cross-platform backup and syncing service, Dropbox. One of the greatest things about it is its ability to be used on multiple platforms. When I made the switch from Windows to Ubuntu, all of my important documents were automatically downloaded and synced to my new OS. I also really enjoy the ease of use, online access to files, and the fact that I get 2 GBs free!
How to install Dropbox:
First of all, Dropbox is proprietary software and therefore cannot be included in the Ubuntu repository. To get around this, Dropbox has created a small script called nautilus-dropbox that can be added to the repository and installed in Ubuntu. The nautilus script is used to download and install the proprietary Dropbox daemon from the web. The download options below download, install, and and then run the nautilus-dropbox script.
Option 1: Download and install the deb file from Dropbox’s website.
See the Install the Dropbox daemon section below for installation details.
Option 2: Add the repository and install nautilus-dropbox from Terminal.
Run the following code in Terminal.
1. Add the repository.
echo "deb http://linux.dropbox.com/ubuntu $(lsb_release -cs) main" | sudo tee "/etc/apt/sources.list.d/dropbox.list" > /dev/null
2. Add the public key.
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
3. Update the repository.
sudo apt-get update
4. Install nautilus-dropbox.
sudo apt-get -y --force-yes install nautilus-dropbox
Optional: nautilus-dropbox should automatically launch the Dropbox daemon. If it does not, run the code below.
dropbox start -i
5. Proceed to the Install the Dropbox daemon section below.
Option 3: Download my install_dropbox script and install nautilus-dropbox from Terminal.
1. Download the script.
wget http://dl.dropbox.com/u/16428/scripts/install_dropbox.tar.gz
2. Unpack the script.
tar xvzf install_dropbox.tar.gz
4. Make the script executable.
chmod +x install_dropbox
5. Run the script.
./install_dropbox
6. Proceed to the Install the Dropbox daemon section below.
The script can also be downloaded here.
Install the Dropbox daemon
This section takes you through the steps of installing the Dropbox daemon.
1. Click the Start Dropbox button.
Alternative: Dropbox daemon can also be started using the following code in Terminal.
dropbox start -i
2. Check the Don’t show this again checkbox and click OK.
You should now see a download dialog window.
The next windows is the unpacking dialog window.
3. If you already have a Dropbox account, select the I already have a Dropbox account option and click Forward and skip the next step. If you don’t have a Dropbox account, leave the default option and click Forward and move onto the next step.
4. Create your Dropbox account by filling in your personal details and click Forward. Be sure to check the I agree with the Terms of Service checkbox!
5. Log in to Dropbox using your new or existing username and password and click Forward.
Dropbox keeps track of which computers you are syncing with your account, so make sure to name your computer something that makes sense.
6. Choose which account type you use.
I, personally, have used the 2 GB account for the past 3 years or so and have not had a problem with running out of space because I only sync important documents.
7. You can choose to either take a tour of Dropbox if you’re a new user, or you can skip the tour by clicking the Skip tour and finish button.
8. Choose to use the default Dropbox Folder Location or choose you’re own by checking the I want to choose where to put my Dropbox folder checkbox.
The option to choose where to put the Dropbox folder is a very convenient option, especially if I have to resync Dropbox to an existing Dropbox folder. If you choose to resync Dropbox to an existing Dropbox folder, be sure to use the parent folder.
9. Restart nautilus by clicking the Restart Nautilus button.
Alternative: you can also restart nautilus by running the following code in Terminal.
nautilus --quit
Congratulations. You have now finished installing Dropbox for Ubuntu! To use Dropbox, just create documents inside the Dropbox folder and the documents will automatically be uploaded to Dropbox’s server. To share documents between computers and/or operating systems, install Dropbox on the computers and/or operating systems.
In future posts I’ll show you how to update Dropbox to the latest experimental builds using Dusten B.’s script and customize the notification icons.
[Update] Added How to Update Dropbox to the Latest Experimental Build Using dbupdate [HOWTO]
Preferred Applications
I’m constantly on the prowl for new and efficient applications to accomplish my everyday tasks in Ubuntu. My main reasons for liking an application are; free, easy of use, works out of the box, speed, matches my theme, and community supported. I don’t care if the applications has all of the ‘frills and thrills’ as long as it works.
Here is a list of my preferred applications:
- OS: Ubuntu Lucid Lynx 10.04 LTS
- Internet browser: Google Chrome unstable
- Email: Gnome-Gmail
- Music player: Quod Libet
- Video player: VLC
- Editor: gedit
- Chat: Empathy
- File sync: Dropbox
- File launcher: Do
- Dock: Docky
- Scanning: Simple Scan
- Virtualization: VirtualBox
- Download manager: Uget
- FTP Client: FileZilla
- PDF ‘editor’: PDF Shuffler
- BitTorrent: Transmission
I will be blogging about some of the applications and how I use and modify them to my liking.
Make sure to visit my Preferred Applications page to see what I’m currently using!
Current Desktop
My first post is showcasing my current Ubuntu desktop and configuration.
My current desktop has the following:
- Docky with the Gmail, Weather, and Mounter docklets
- Radiance theme with Droid fonts
- Wallpaper: Hurrah Ubuntu by pr09studio
- Top Panel:
I’ll update this post every now and then to document my desktop upgrades and modifications.
About new2ubuntu
Welcome to new2ubuntu! new2ubuntu is a blog dedicated to the exploration and customization of Ubuntu. The main topics that will be covered in this blog is how to customize the look, feel, and function of Ubuntu, and what my setup is for Ubuntu.
A few of the topics that I’m to cover are:
- Customizing system tray icons, panels, and desktop.
- My preferred applications and their settings and customizations.
- Ubuntu bug fixes.
Being a dedicated techie, I tend to run the latest development and test builds of applications, meaning I’ll be writing about Ubuntu Lucid Lynx 10.04 LTS.
I’m excited to share all of my Ubuntu experiences!


























