LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-05-2010, 02:42 AM   #1
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Rep: Reputation: 15
Problem in using inittabl to call a function in CentOS


Can someone help me!

1. I am using CentOS 5.4 and I try to use inittab at the etc/inittab to initiate a program at startup

2. Below is my script and saved as heritrix.sh
#!/bin/bash

export HERITRIX_HOME=/root/heritrix-1.14.3
cd $HERITRIX_HOME
chmod u+x $HERITRIX_HOME/bin/heritrix
$HERITRIX_HOME/bin/heritrix --admin=LOGIN:PASSWORD --port=9090

3. I did the chmod +x for the permission already.

4. I not confirmed whether it is running at startup.

5. the script is no problem as I have check it
 
Old 07-05-2010, 03:07 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Hi,

Why don't you use rc.local to run your script?
 
1 members found this post helpful.
Old 07-05-2010, 03:13 AM   #3
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
can teach me how to use that?
 
Old 07-05-2010, 03:21 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Just edit /etc/rc.local and add a line at the end of the file, with the path to your script:
Code:
/path/to/heritrix.sh
Regards
 
1 members found this post helpful.
Old 07-05-2010, 04:29 AM   #5
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
cant generate. Something is missing. Please help me
 
Old 07-05-2010, 04:44 AM   #6
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
cant generate. Something is missing. Please help me
 
Old 07-05-2010, 04:48 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
What you mean can't generate?
Open with your favorite text editor the file /etc/rc.local and add a line that contains the full path to your script.

Last edited by bathory; 07-05-2010 at 04:52 AM.
 
0 members found this post helpful.
Old 07-06-2010, 12:21 AM   #8
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
your description is too short

1. I go to the etc/rc.local

2. Then, i typed in my path /root/heritrix.sh

3. but it doesnt work, the application cannot be called with the command in the heritrix.sh
 
Old 07-06-2010, 01:15 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Huh, in what way the description is too short?

To edit a file, as root, write in a terminal:
Code:
nano /etc/rc.local
Use the down arrow to scroll to the end of the file and add the line that runs your script:
Code:
/root/heritrix.sh
Save and exit (press Ctrl-x, press "y" without quotes, press enter)

On system reboot, the rc.local script is the last one that is run and so it runs any commands inside the scripts.

Regards
 
Old 07-06-2010, 04:01 AM   #10
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
ok thanks for reply, the script can run. My PC hangs after the loading my script.

1. I have checked my script, is correct because can run at terminal

2. By the way, the script I run will run the web archiving software with the GUI on the web browser.

3. So my concern, rc.local is the correct way to do it? or use other function.

Please provide me suggestion. Thanks in advance and I really hope to hear from u soon.
 
Old 07-06-2010, 04:15 AM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
What happens when you run the script from terminal? Does it exits automatically, or it just sits there.
You can add a "&" at the end of the command, like:
...
Code:
$HERITRIX_HOME/bin/heritrix --admin=LOGIN:PASSWORD --port=9090 &
so it runs in the background

Regards
 
1 members found this post helpful.
Old 07-06-2010, 05:18 AM   #12
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
when I run it at terminal, the web browser will pop-out and start the mainpage of the application.

Thanks a lot. I will try it
 
Old 07-06-2010, 05:38 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
If the program that runs through your script needs to open a browser, then I'm afraid this method is not going to work, because at the time rc.local is run there is no graphical environment yet.
What you can do is to tell gnome to run your script at startup. Go to System -> Preferences -> Sessions, select "Startup Programs" , click "Add" and add the path to your script.
 
1 members found this post helpful.
Old 07-07-2010, 01:12 AM   #14
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
sorry for my previous post. The script will generate as shown in the first screen capture.

The second screen capture will be generate when & is added to the script

these are generated at the terminal
Attached Thumbnails
Click image for larger version

Name:	Screenshot.png
Views:	7
Size:	27.4 KB
ID:	4052   Click image for larger version

Name:	Screenshot-1.png
Views:	4
Size:	51.8 KB
ID:	4053  
 
Old 07-07-2010, 01:40 AM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Ok, so it exits when run from an xterm.
If that's the case, remove the script from /etc/rc.local and put it in gnome startup programs you'll be set.

Regards
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] g++ error message no matching function for call to some function Jerry Mcguire Programming 6 04-13-2010 09:37 PM
problem of function call address in executable file valpa Programming 12 09-05-2008 09:36 AM
Compilation issue when Function is parameter in function call on LINUX sa20358 Linux - Software 2 07-24-2008 11:19 PM
weird PHP problem: Call to undefined function mysql_connect() Shioni Linux - Server 4 12-22-2006 06:26 AM
problem on dynamic function call inside a class! antony_csf Programming 0 06-29-2004 11:15 PM


All times are GMT -5. The time now is 05:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration