Page 1 of 1

rc.local doesn't execute my line, but SSH does

Posted: Sat Nov 28, 2009 6:12 am
by Kreshna
I have an application called fgs. In order to start it, I need to do the four following tasks:
(1) Log in as kresh (user who owns the fgs application)
(2) cd /home/kresh/fgs
(3) . setenv.sh (from inside /home/kresh/fgs)
(4) fgs start (from inside /home/kresh/fgs)

I want fgs to autostart, so I put the following line in rc.local:

Code: Select all

su kresh -c "( cd /home/kresh/fgs/; . setenv.sh ; fgs start)"
But when I restart the server, fgs does not start. However, when I execute the above line as root:

Code: Select all

[root@devserv ~]$ su kresh -c "( cd /home/kresh/fgs/; . setenv.sh ; fgs start)
fgs starts flawlessly.

I suspect it is a login problem, ie, rc.local fails at the su kresh part.

I have tried the following line as well:

Code: Select all

sudo su kresh -c "( cd /home/kresh/fgs/; . setenv.sh ; fgs start)"
Again, rc.local doesn't seem to execute that, but executing it after logged in as root succeeds.

What should I do? By the way, I'm using CentOS 4.2.