Monday, July 25, 2011

Auto startup applications in Ubuntu Linux

Ubuntu has a startup menu as in Windows.  It's at System>Preferences>Startup Applications.  It's fine if it's a GUI user application.

If your application has no GUI, such as a command or a script, you can put it in .login.  Of course NOT, now they use .profile if you the default Gnome desktop.

Many applications can be a command or with GUI.  You can pick one of the two methods.

Many times you have a mix of both such as in a script, or you do not want to learn both methods.  Now here's some techniques for mix and match, either using .profile or Startup Applications.

First, the most troublesome are commands/apps that require privilege access.  "sudo yourcommand" do not usually works in Startup.  Instead you need "su-to-root -X -c command".  -X means it's GUI.

To eliminate superuser password prompt on some of the apps, you can do:

sudo visudo

add the following line to the end of the file:

yourusername ALL = NOPASSWD: /usr/sbin/firestarter, command2, etc

Never force edit when there are parse errors, or you need to go into recovery mode.  (The safer alternative using sudoers.d do not work using the same syntax.)

To run a command as a GUI program, all you need to do is give it a GUI terminal:

gnome-terminal -e "your command"

It's also the simplest way to say Hello World in Gnome.

Many times you don't really need the Startup App.  For example, you can put this in the .profile:

truecrypt mountfile /media/truecrypt1

Obviously the best thing about Linux is that backup is easy (via a command and cron) and built-in.  Backing up encrypted volumes into encrypted volumes is also the same.  You just need to mount the volume as above and then backup.  The alternative is to copy the whole encrypted volume, a few GB or much more usually, that you don't want to every day.  You can do incremental backup every hour.

In Windows it's terrible. 

No comments: