Code I/O

A topnotch site

5 Minutes on Linux: Automating app launch on boot

Leave a comment

Adding corn jobs is a way to automate launching of apps. Another approach is to make those apps launch when a user logs in. Depending on how the app must be started up, one can make the right choice.

Add a wrapper to the binary to launched in /etc/init.d

echo "/home/tester/tools/apache-httpd/bin/apachectl $1" > /etc/init.d/start-apache
update-rc.d start-apache defaults 3
service start-apache start

Here is my experience: I wanted to index media on an external drive; one of the coolest indexing app I found is AutoIndex which is a PHP module (so runs under apache httpd); however this possessed a challenge. The external NTFS driver gets mounted by gvfs (fuseblk); Since I wanted to manage the drive via gvfs (and not via ntfs-3g mounting via fstab), I thought it was a good idea to leave it that way.

Now the challenge was to get apache running as a service (launched by user “daemon”) to access the gvfs mounted drive. The permissions cannot be changed (at least I have not found a resolution there).

Then, what’s the solution?

Install apache and php modules in a user account (user: tester)
Make the tester auto-login on boot
Add apache (user installed) to launch on login: (GNOME: System -> Preferences -> Startup Applications")
Add "gnome-screensaver-command -l" (Lock the screen): (GNOME: System -> Preferences -> Startup Applications")

You’ll have the user installed apache running on boot and have the screen locked for security purposes.

This is a hack I did at home to get media streaming work with drives mounted by gvfs.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s