How to autorun sh file

General support questions including new installations
Post Reply
Cuizhe
Posts: 8
Joined: 2016/01/08 10:58:29

How to autorun sh file

Post by Cuizhe » 2016/01/22 02:45:34

Hello,

I have a applicaton folder in /home/ which start with run.sh.
In run.sh, there are some export commandline.
I want to auto start run.sh when my server system start and restart.
How can I do it?
I created file on /etc/rc.d/init.d.
Then run chkconfig --add, chkconfig on command.
But when I restart system, it doesn't working.

Thanks in advice.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to autorun sh file

Post by gerald_clark » 2016/01/22 12:15:26

What are you really trying to run?
Exports from an init.d service are not available to users, and init.d tasks have a structure that must be followed.

Cuizhe
Posts: 8
Joined: 2016/01/08 10:58:29

Re: How to autorun sh file

Post by Cuizhe » 2016/01/22 12:20:35

My difficult is export commandline.
When I used export command line in shell,
I can't check it on command line.
How can I check it?

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to autorun sh file

Post by gerald_clark » 2016/01/22 12:50:30

When you export a variable in a shell script, the variable is local to the script, and disappears when the script exits.
Please explain what you are really trying to run, instead of being vague and secretive.

Post Reply