Quote:
Originally Posted by politik
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.