Link to home
Start Free TrialLog in
Avatar of piratepatrol
piratepatrolFlag for United States of America

asked on

Starting a Process Automatically on Reboot

Hi Linux friends,

All I want to do is to have a process start automatically when the server reboots.  Nothing fancy.  Right now, I manually start the process like this:

[root@localhost root]# cd /programfiles/tibco/tra/domain/TuxDomain/
[root@localhost root]# ./hawkagent_TuxDomain

I also have another process where I have to send it a parameter:

[root@localhost root]# cd /programfiles/tibco/ems/bin
[root@localhost root]# ./tibemsd -config FTBackup/tibemsd.conf

I know I have to do something with /etc/init.d, but I'm not sure exactly what.  

Thank you so much,


Jazon
Avatar of Tim_Utschig
Tim_Utschig

If you're running a Red Hat-ish distribution, you can put the commands in /etc/rc.d/rc.local
Avatar of piratepatrol

ASKER

I have Fedora Core 2.

The tricky part is that one of the processes is the type that if you start it in the console, it runs, but then stops if you close the console.  Given that, can I still do the following:

cd /programfiles/tibco/tra/domain/TuxDomain/
./hawkagent_TuxDomain

cd /programfiles/tibco/ems/bin
./tibemsd -config FTBackup/tibemsd.conf

The first one is the one that stops when I close the console.

Thanks again.
> The first one is the one that stops when I close the console.

Try prepending "nohup " and appending "< /dev/null > /dev/null 2>&1" to the command, e.g:

    nohup ./hawkagent_TuxDomain < /dev/null > /dev/null 2>&1
ASKER CERTIFIED SOLUTION
Avatar of Tim_Utschig
Tim_Utschig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I really appreciate this, Tim.

This is what I'm putting into the rc.local file...


# Start TIBCO Hawk Agent.
cd /programfiles/tibco/tra/domain/TuxDomain/hawkagent_TuxDomain
nohup ./hawkagent_TuxDomain < /dev/null > /dev/null 2>&1

# Start the primary and backup TIBCO EMS instances.
cd /programfiles/tibco/ems/bin
nohup ./tibemsd < /dev/null > /dev/null 2>&1
nohup ./tibemsd -config FTBackup/tibemsd.conf < /dev/null > /dev/null 2>&1

# Start the TIBCO Administrator.
cd /programfiles/tibco/administrator/domain/TuxDomain/bin
nohup ./tibcoadmin_TuxDomain < /dev/null > /dev/null 2>&1

Do you see any problems with this setup?
> Do you see any problems with this setup?

No.
However I'm not familiar with the particular programs you are running.
I'm going to reboot my Linux server and hope for the best!  :)

I'm the TIBCO administrator for my company, and TIBCO is a huge software package used for systems integration.

We use all Microsoft at work, but I'm just playing with it in my Linux server at home.  I'll let you know if all is well after the reboot.  Your help is deeply appreciated.
Hi Tim - here's the error I get . . . .

/etc/rc3.d/S99local: line 10: cd: /programfiles/tibco/tra/domain/TuxDomain/hawkagent_TuxDomain: No such file or directory

I don't know why it's saying this.  Here's proof I didn't have a typo . . . :)

[root@localhost TuxDomain]# cd /programfiles/tibco/tra/domain/TuxDomain
[root@localhost TuxDomain]# ls
AdministrationDomain.properties  hawkagent_TuxDomain      plugin
application                      hawkagent_TuxDomain.tra  rulebase
AuthorizationDomain.properties   inithawk                 startup
autoconfig                       local.properties
hawkagent.cfg                    logs
[root@localhost TuxDomain]#

Any thoughts?
Oh gosh, I'm stupid.  Hold on...
Heh, sorry I didn't catch that.
Okay, I changed

cd /programfiles/tibco/tra/domain/TuxDomain/hawkagent_TuxDomain

to

cd /programfiles/tibco/tra/domain/TuxDomain

Heheh!  My bad!

I rebooted, and right now it's hung on the following . . .

Starting system message bus:                      [  OK  ]

And that's it.  The cursor is blinking underneath, and it's not going to the login screen.  I used PuTTY to connect to the Linux server from my Windows XP laptop, issued ps -ef , and I notice that only the Hawk Agent is started (this is the first process started from rc.local).  All the others I specified in the rc.local file did not start.  Weird.

Any thoughts on this issue?  Thanks again.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, as pjedmond said, just add an ampersand to the end of commands that don't background themselves.
Worked like a charm!  You guys are awesome.  Thank you so much.