How to Autorun a program in Linux(Centos)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to Autorun a program in Linux(Centos)
# 1  
Question How to Autorun a program in Linux(Centos)

HI Expert, Smilie

CAn some1 guide me how to run a program automatically whenever the PC/Server is rebooted ?

Im not sure where to start from. PLease refer to the pic attached and do help me. Thanks in advance


----------------------------------------------------
How to Autorun a program in Linux(Centos)-rddjpg
How to Autorun a program in Linux(Centos)-projpg

Last edited by crazydude80; 08-15-2012 at 08:42 PM..
# 2  
Hi,

The system usually will have a link in /etc/rcX.d to /etc/init.d/file these are the normal ways of starting something - they are normally started with the start/stop options. all you should have to do is decide what run level that you would like the program to start at and adjust the shell to sort iy out!

Regards

Dave

Last edited by gull04; 08-15-2012 at 10:40 PM..
# 3  
There are several ways to achieve this and you might want to research the "Unix boot process" to better understand the details involved.

gull04 had it right, an init-script is probably what you might need. Check the chkconfig --list command for a list of configured services and read its man page to understand how to modify the configuration of various init-scripts.

I hope this helps.

bakunin
# 4  
use crontab
edit crontab file (crontab -e) as below
Code:
@reboot <joblist>

joblist contains the jobs you have to run during start-up
# 5  
Hi ,
im still confuse.. can some1 update on this !!

my Pgm dir:
Code:
[iosmsrv@iosmsrv ~]$ cd ../../mfgdata/pcount/program

to run the pgm, need to type as below:
Code:
$ db2start              <Enter >   
$ java  FileFind  &   <Enter>

1) how to write the script to call the program:

--------------------------------------------------------------------------

Code:
#!/bin/bash

?
?
?


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.


---------------------------------------------------------

Last edited by zaxxon; 08-23-2012 at 04:31 AM.. Reason: code tags
# 6  
write your commands in script file

Code:
script.sh
=======
cmds
....

edit crontab file by using command
Code:
crontab -e

the above command open crontab file
enter the following code in opened file

Code:
@reboot path/to/script.sh

save and quit

commands in script.sh will execute when system starts...
# 7  
Quote:
Originally Posted by praveen_reddy
write your commands in script file

Code:
script.sh
=======
cmds
....

edit crontab file by using command
Code:
crontab -e

the above command open crontab file
enter the following code in opened file

Code:
@reboot path/to/script.sh

save and quit

commands in script.sh will execute when system starts...

I'm stuck at the script potion. Not sure about the commands to use for the scripts. Any suggestion ? Thanks
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #76
Difficulty: Easy
Richard Stallman's GNU project was also started in response to AT&T's increasingly restrictive Unix software licensing terms.
True or False?

10 More Discussions You Might Find Interesting

1. Cybersecurity

Is there an Automated script for CIS CentOS Linux 7 Benchmark please?

Hi, Apologies if this is not right section to post my requirement. We have a requirement to enhance our Centos 7 Servers' security as per "CIS CentOS Linux 7 Benchmark" ( CIS WorkBench / Home ) that provides guidance for establishing a secure configuration posture for CentOS 7. Just... (2 Replies)
Discussion started by: prvnrk
2 Replies

2. Shell Programming and Scripting

Good way to check firewall port on Linux centos 7

Hi, I need to know what kind of firewall settings does the linux box have? Is port 25 blocked in any way? Linux techx 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux I'm coming from this thread. (1 Reply)
Discussion started by: mohtashims
1 Replies

3. Red Hat

Run program compiled in Ubuntu in centos

Will a program compiled in ubuntu 14.04 execute in Centos 7? That is to say a tarball or zip is downloaded from github and extracted, compiled, and make is all done in ubuntu 14.04, can I mv the program from ubuntu 14.04 to Centos 7, add it to path in Centos 7. And run it? Thank you :) (3 Replies)
Discussion started by: cmccabe
3 Replies

4. Shell Programming and Scripting

How to schedule a shell script in Linux centos?

Hi All, I have a script that I need to schedule on daily basis. How can I schedule a script in centos. Like I want to run that script evryday at 10 AM and can I store the output of the script in a log file. Thanks ---------- Post updated 04-18-14 at 12:52 AM ---------- Previous update... (0 Replies)
Discussion started by: Palak Sharma
0 Replies

5. Red Hat

Hack a centos Linux box

HI, I have a Centos linux box and there is interface connect to internet. I stop the iptables in this box . After a few day , I find the linux box have been hacked and install some perl script into the box . Could anyone tell me how the hacker can login into the centos box without knowing... (1 Reply)
Discussion started by: chuikingman
1 Replies

6. IP Networking

Linux centos, can't connect whois.tucows.com

Hello, when i tried to get whois on an .com domain, it automatically used tucows whois, it appears it cant connect that server, please how can i fix it, so it dont fail or use another server? whois mydomainname.com -f + whoisout=' ' I have: Linux * 2.6.18-348.3.1.el5.028stab106.2 #1... (5 Replies)
Discussion started by: postcd
5 Replies

7. Emergency UNIX and Linux Support

Websockets proxy on CentOS Linux?

I need to setup a proxy that will sit in front of a websockets server and proxy websockets communication both to and from the server. There will only be one specific client trying to access this server using the websockets protocol. We can configure the proxy settings for port and IP on the... (3 Replies)
Discussion started by: glev2005
3 Replies

8. Red Hat

Authentication Failed in Linux centos

Hi everyone ... ( Linux Cent OS ) i cant login as root user in my lab machine ... i did give correct root and root passwd ..but it showing Authentication Failed ... plz help me (0 Replies)
Discussion started by: coolboys
0 Replies

9. Linux

sort command in centos linux os

Iam working on centos os. Iam not able to sort records without option Please help me out Jayaprakash B. (1 Reply)
Discussion started by: jpachar
1 Replies

10. What is on Your Mind?

Linux Centos 5.4 BTMP file size

Dear fellows, I have Centos 5.4 linux with DNS server, all logs are normal, in my /var/log/ btmp files is getting larger day by day. What is this btmp file for? How can i reduce the file siez or control file size. Waiting. MAZ (1 Reply)
Discussion started by: maz
1 Replies

Featured Tech Videos