Help - Search - Members - Calendar
Full Version: Running Startup Script As Different User
Linuxhelp > Support > Technical Support
lucidthoughts
Hello all,
I have a script (specifically one that just runs a single program to start a license server).
The catch is that it has to be run by the user 'matlab'.

How do I go about making it so that when the computer boots up this is automaticallly done as opposed to having to su to user matlab and then running it manually?

Thanks!
hughesjr
in the startup script, you would use the command:

su - matlab -c script_to_start

Note: The users environment might not load, so in the script_to_start, be sure to source the users .bashrc and/or .bash_profile file if required at the beginning of the script.
petterg
my experience is that su may not run from scripts.
If thats the case for you - try using sudo (www.sudo.ws)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.