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

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Kreshna
Forum Newbie
Posts: 7
Joined: Mon Nov 02, 2009 10:50 pm

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

Post 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.
Post Reply