LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 12-10-2007, 08:55 PM   #1
mokku
Member
 
Registered: Feb 2007
Posts: 197

Rep: Reputation: 30
chkconfig and linux scripts


I would like to one of my script in startup, I have copied into inist.d directory and try to do the followig command and it doesn't work.

# chkconfig dnstest on
service dnstest does not support chkconfig


Does dnstest file needs to be in any standard format? PLease let mek now.
 
Old 12-10-2007, 09:00 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
assuming the file is workable, you need to

chkconfig -add dnstest

to "add" the service to chkconfig before "chkconfig dnstest on". You only need to add it once

(please check format in man page - writing from memory)

Last edited by billymayday; 12-10-2007 at 09:01 PM.
 
Old 12-10-2007, 09:19 PM   #3
mokku
Member
 
Registered: Feb 2007
Posts: 197

Original Poster
Rep: Reputation: 30
Thank you, but isn't it same command. I tried and getting same error.

# chkconfig --add dnstest
service dnstest does not support chkconfig

Am I missing anything here? Please help me.
 
Old 12-10-2007, 09:34 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Could you post the header of your script?

Usually the scripts in /etc/init.d are wrapper scripts that start daemons or other scripts.
Look for /etc/init.d/skeleton. If it exists, you can base such a script on it.

Last edited by jschiwal; 12-10-2007 at 09:37 PM.
 
Old 12-10-2007, 09:41 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
And chkconfig --add XXX is not the same as chkconfig XXX on. Add adds the "service" into chkconfig, On tells it what to do at startup for each runlevel
 
Old 12-10-2007, 09:45 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
They are not the same commands. Actually your first post the command does not have the correct syntax.
See man chkconfig for more information.

The initscript header does have a certain format. The format depends on the linux distribution/version you are running. Have you looked at the files already in the /etc/init.d directory?
 
Old 12-10-2007, 09:50 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Onther way around the problem, especially if you just want a one-off execution, is to run the script from rc.local or you can even run it from a user's cron with @reboot
 
  


Reply



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
Why do I get "bash: chkconfig: command not found" when I try to run chkconfig? non-thrash Fedora 10 05-20-2010 12:31 PM
solaris equivalent of chkconfig and service of redhat linux sanjeevkchopra Solaris / OpenSolaris 3 07-11-2006 03:45 PM
AIX equivalent of chkconfig and service in redhat linux sanjeevkchopra AIX 1 07-11-2006 10:07 AM
chkconfig ?? jchin Linux - Newbie 4 10-16-2003 01:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:15 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
Open Source Consulting | Domain Registration