Simple way to execute a command on startup in Ubuntu

I would like to share with you a simple way to execute commands on startup in Ubuntu. This tip is very useful for example I have an issue on the Netatalk service that do not run properly so every time I have to run the command to restart the service after I login to Ubuntu.

All commands that you need to be executed must be stored in etc/rc.local setting. Open terminal then execute this command:

sudo nano /etc/rc.local

Add the following command to restart Netatalk service, right before “exit 0":

sudo service netatalk restart
exit 0

That’s it! It’s so simple. I have solved the Netatalk service problem for now. So I have more time to take a look what is the problem with the Netatalk service.

Mac OSX Mountain Lion 10.8.5 Just Released

image

Mountain Lion 10.8.5 just released and available for download. All users with 10.8.4 are recommended to upgrade.

I just upgraded my macs without any issues. All apps work fine including my Time Machine setup using shared folder in Ubuntu. No additional setting needed.

Macbuntu Precise Pangolin Wallpaper

I just completed the upgrade to Ubuntu 12.04 Precise Pangolin. I get to like the new look of Unity and the HUD simplicity design.

Macbuntu Precise Pangolin on Wood 1280×1024

 

So I created a new natural, simple and clean wallpaper, to make it look nicer. I took the idea of this nice text design from Oneiric Ocelot wallpaper by Tux-planet. The text is blended to the wood skin from maciad.com, and give a burned-pressed effect on the wood.

The logo is from the two OS that I use, my favorite systems, Mac and Ubuntu, that work together for my daily work.

Yes, it says Macbuntu, actually it is my work-in-progress to find the best Macbuntu theme for Pangolin. Tell me if you like it.

Upgrade Netatalk

At last I have a chance to upgrade new updates of Netatalk 2.2.2 that already released two months ago.  The Time Machine and my shared folders work great with no issues. I use Ubuntu 11.04 and my Mac use latest version OSX Lion 10.7.3.

I see that new features are not really for Ubuntu, but there are some updates and bugs fixes that are useful to users. So it is recommended to upgrade for users who uses version 2.2.1.

This article is for you who already used Netatalk 2.2.1 and follow this post. If you are new to Netatalk, please follow the steps in that article. Read more of this post

Share DVD drive in Ubuntu 11.04 for Diskless Mac using Open SSH and Macfusion

Sharing folder is one of important features that you must have if you work with multiple computers in a network. In my home office I use Ubuntu 11.04 as my file server. I have Mac and Windows boxes in the network and I have common files that are used by many users like pictures, musics, etc.

If you use diskless Macs like Macbook Air or Mac Mini, of course you would need to use the DVD drive in other machine or buy external DVD drive. I have shared to you how to Setup Shared DVD in Ubuntu for Mac OSX Lion using AFP and netatalk. It works fine, but rather slow.

There is another solution we can use is using Open-SSH. I recently test using it. It works fast, faster than using netatalk. I think comparable with SMB file sharing. And the setup is simple.

This article tells you how to set it up. We will use a very useful tool Secured Shell (SSH) using openssh in Ubuntu 11.04 Natty Narwhal. This should also work in newer Ubuntu 11.10 Oneiric Ocelot or other version of Ubuntu. Let’s start how to do this.

Setup OpenSSH

Login to your Ubuntu PC. Open terminal, then type:

sudo apt-get install openssh-server

The command will use standard setting for ssh such as use standard port 22 for ssh, and use protocol 2. You can change the setting if you like, for example if you would restrict access based on IP for your ssh server. Or just skip you don’t change anything.

sudo nano /etc/ssh/sshd_config

Setup your DVD media

You need to tell ubuntu to auto mounting the DVD drive with generic mounted volume so we can set it as shared volume.

sudo nano /etc/fstab

Add the following line at the end of the file.

/dev/dvd /media/dvd auto user,noauto,exec,utf8 0 0

Setup Macfusion

To access the server from Mac, I use OSX Fuse and Macfusion, download both software. You need OSX Fuse to run Macfusion. Install OSX Fuse and then Macfusion. Make sure you install Compatibility Layer when installing OSX Fuse. Then follow the rest of installation instruction to complete the setup.

Open MacFusion click the “+” sign at the left bottom to add new device. Then select SSHFS option. Go to SSH tab. I name it DVD, fill the IP as your SSH server IP, User Name and Password as what you have defined at your server, and fill the Path as your share folder that you setup in Ubuntu server.

Ignore the SSH Advance tab if you use the default settings at your server. Go to the Macfusion tab,  leave the Mount Point as default and fill the Volume Name as you wish to be displayed in the mounted device at your Mac, I fill it “Remote Disc”. You can change the icon if you like.

To mount your new drive, just click mount. You will be ask to enter the password, key in the password and click the check box Save Password in Keychain.

Your mounted drive will be on your desktop. To access it from any application, enable the home folder at your favorites in the Finder preference setting. Open Finder – Preferences, click Sidebar tab, click the check box of your machine under Devices.

Once completed, open Finder, click your Mac machine under Devices at Sidebar. You will see mounted DVD is on the list.

Source:
Share my DVD drive with my Mac Mini over LAN
http://macfusionapp.org/

Set Virtualbox machine to separate desktop space in OSX Lion

 

 

One of new features in OSX Lion that I found very helpful is the icon at top right corner of every window. When you click it, the application will automatically open in a new desktop space. You can easily switch between working application, especially if you use a track pad or magic mouse.

Unfortunately many applications are not natively support this feature yet. It is a bit annoying that to switch between application you have to use a lot minimize-maximize icon, or run them in smaller windows then switch manually. This is not a problem anymore if you have upgraded to version 10.7.2. There is a new great feature answers this problem that I have been waiting for. Now you can manually manage spaces, rearrange them as you like easily.

One of example application that perfectly fit for this feature is virtual server application. Ideally every OS is running in separate desktop window space. You will feel really like working in different environment when you switch between each machine as if you have many dedicated machines. Since I use VirtualBox, I will show you how to do it in VirtualBox. The latest version of VirtualBox still not supports this feature.

Open VirtualBox, run your virtual machine, don’t change the window to fullscreen, after it is completely running, open Mision Control. You will see all opened windows, and opened desktops (with smaller window) at the top of the screen. Drag the virtual machine window that you wish to move to the top right area until a new window with “+” (plus) sign appear, then release your mouse to drop there. This action will create new desktop window. You can rearrange the order of opened desktops. Click the desktop that running the virtual machine, from there you can activate to full screen mode.

To remove the desktop, open the Mission Control, move your cursor to the desktop window that you want to remove, you will see the remove “X” icon. Click it to remove.  You can save your preferences in Mission Control Preference.  Open System Preferences, select Mission Control, set to Automatically rearrange spaces based on most recent use.

Source:
Manually rearrange full-screen apps, spaces in OS X Lion 10.7.2 

Connect to AFP Server Automatically

If you want to connect to server every time you logon, is very simple in Mac. We can utilize Apple Script to do the magic. In this tutorial is using example from my previous post, Share Folder in Ubuntu 11.04 for Mac OSX Lion, how to mount Time Machine disk in Ubuntu server.

Applescript is very useful and simple tool available in Mac OSX that can help us to do whatever we want.

Create the script

The logic for this task is first to check if the volume is exist, if not then the share server is not connected so tell Mac to connect to server. Second is add it to Login Items List to run it automatically.

Open the AppleScript Editor. From Finder open Applications - Utilities - AppleScript Editor. Then copy and paste the following code.

tell application "Finder"
if not (disk "TimeMachine" exists) then
mount volume "afp://username:password@192.168.1.10/TimeMachine"
end if
end tell

Change the username and password as whatever you have created in your server. You can also add more disks to the script for example mount share disk, DVD, etc. if you like.

Save it to whatever you want, for example connect_afp_server.

Testing

Let’s do the testing. Make sure you are not connected to the server. Disconnect it or unmount the disk from Finder if you are connected. Go back to AppleScript Editor, click Compile button. If you see no error then click Run button. You should see file: "TimeMachine" at the Result pane. Check from Finder to see if your mounted disk is there.

Run Automatically

To run it automatically we need to run the AppleScript every time you login. First we have to save the script as Application. From AppleScript Editor click Save As, Select File Format as Application. Click Save button.

Then add it to the Login Items List. Open System Preferences, click Users & Groups. Select the user or group that you usually use. Select the Login Items tab. Then click the + button to add the AppleScript. Find the script you just created. See the column Kind, make sure you select the one with Application kind.

One more test to check if the script works as what we want. Logout, then login again, wait a few seconds, we have to let Mac run the script and mounting the disk. If you see the Dock carefully you will see AppleScript icon popping up a second when the script is running. Then check from Finder if the TimeMachine disk is mounted.

That is it. Now your Time Machine Disk is automatically connected.