LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-24-2010, 09:15 PM   #16
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208

Quote:
Originally Posted by politik View Post
Yes my objective is user specific. How do I have my script run after a user has logged in ? Would this be achieved by the different runlevels ? Or put the lines at the end of rc.local ?
Well, you can't do anything which is specific to which user has logged in until, er, the user has logged in. That cannot be until the system moves to whichever run level provides a login prompt which is generally after the boot scripts have finished.

The straightforward way to do it is for the user to initiate it at login -- from shell startup files or alternatively, if graphical, from the desktop's autostart system.

Permissions have to be addressed. sudo could be used. I think it can be used to allow one user read-wite mounting and others read-only mounting.

If you really, really want to do it in the boot scripts the rc.local could start a background shell (thus allowing itself to terminate and the boot process to complete) which sat in a loop (delayed, so as not to use al the CPU!) looking for user logon/logoff and mounting/un-mounting as appropriate. Not nice -- synchronous solutions are a lot more efficient and robust than this type of asynchronous solution.

There may be more elegant solutions that I am not aware of.

Last edited by catkin; 06-24-2010 at 09:16 PM. Reason: General Typodynamics
 
Old 06-24-2010, 10:40 PM   #17
politik
Member
 
Registered: Jun 2005
Location: Chicago
Distribution: Ubuntu 12.04 Precise Pangolin
Posts: 48

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by catkin View Post
The straightforward way to do it is for the user to initiate it at login -- from shell startup files or alternatively, if graphical, from the desktop's autostart system.
I tried using the autostart feature for my desktop environment manager (xfce) but at the time I tried it, the network interface came up way later than the desktop autostart routine. I have since removed Network Manager and the network interface is coming up way earlier now (commands to mount network resources in fstab and rc.local are now working) so I may give this option another go.

Thanks again for your input catkin.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing environment variables into bash scripts JDska55 Linux - Newbie 1 08-11-2009 04:27 PM
Accessing environment variables in startup scripts sanjeevkchopra Linux - Security 2 07-10-2006 10:16 AM
Scripts & Environment Variables geeman2.0 Linux - General 12 07-05-2005 05:10 PM
Why can't my scripts set environment variables? Matthew3 Linux - Software 5 08-28-2004 05:26 PM
Environment Variables in Scripts louisb Linux - General 3 01-15-2004 04:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration