LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chkconfig and linux scripts (https://www.linuxquestions.org/questions/linux-newbie-8/chkconfig-and-linux-scripts-605926/)

mokku 12-10-2007 08:55 PM

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.

billymayday 12-10-2007 09:00 PM

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)

mokku 12-10-2007 09:19 PM

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.

jschiwal 12-10-2007 09:34 PM

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.

billymayday 12-10-2007 09:41 PM

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

michaelk 12-10-2007 09:45 PM

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?

billymayday 12-10-2007 09:50 PM

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


All times are GMT -5. The time now is 07:04 PM.