setting the processes to run on startup
hi everybody,
i have this small script for a backup software.. and there is a hint to make links like this.. i am using suse 10.2 and i don't have the directories rc0.d or rc1.d in /etc/init.d. I only have them as files.. can someone help how to deal with it? how can i create links.. another question is, in general, how can i place a process on linux-startup so that i runs after each restart? thnaks.. |
I don't use SUSE, but you might try their forum...
http://forums.suselinuxsupport.de/in...howtopic=52444 |
in redhat and fedora, you can put the script command in /etc/rc.local file
each and every restart this file gets executed |
The links you provided are both unreachable (403 Forbidden), but in general, scripts to be executed at boot time are in /etc/init.d/ and symbolic links in /etc/rc3.d (for runlevel 3) or /etc/rc5.d (for runlevel 5). The links have a name that starts with "Snn" where the number indicates de order of execution relative to others in the same folder. There are links starting with "Knn" to stops the service in a particular order too.
For example, my e-mail server is Postfix and it is started in runlevel 5. Code:
[root@agente86 ~]# ls -l /etc/init.d/postfix /etc/rc5.d/S80postfix If it is a simple script that does not expect a start/stop argument, or just a command, edit the file /etc/init.d/boot.local and add the command at end of this file. |
thanks for your reply..
i have done what you have said..here is a terminal log which shows the actual state. Code:
mfc-falter:~ # cd /etc/init.d/ but after restart, there is no dsmc process which should be run by the adsm script. i can start and stop manually but not on startup. any ideas? adsm is already wrx for root. thanks.. |
Quote:
I think this is because there is no file "/etc/rc5.d/S80adsm" where "S" means "start". You show us only the "K21adsm" file which will kill the process in that run-level. Test if your adsm script is LSB compliant by running "chkconfig --list". If you get a output that shows in what levels it is on and what levels it is off, then you don't need to create the links by your self. Use chkconfig interface to do that: "chkconfig adsm off" (to remove all links you eventually have created) followed by "chkconfig adsm on" and another "chkconfig --list" to see in what levels it will be run. If it not follows the "chkconfig" interface, remove all K21adsm links and create the "Snnadsm" links in runlevel 3 and 5. You need to carefully choose the right "nn" in a way the script will run only after the services it depends on are already started. |
I Went To Customer To Install Linux In New System But It Is Not Installing At Last I Had Found That The Harddesk Is With Sata Cable.
Why Sata Hdd Not Support To Lunix Then How To Install This While Installing The System Does Not Find Any Hdd Please Help Me What To Do |
Quote:
|
thanks marozsas,
yes i was meaning a system boot (reset) i have done everything as you said, i ran chkconfig --list, level 3 and 5 were on. with chkconfig adsm on/off i set the level on and off. now here is a directory overview Code:
mfc-falter:/etc/init.d/rc3.d # ls -l *adsm* i will post the results when i can make the reboot but i think it should work out.. can you explain me the magic behind the curtain? what does LSB mean? what are all those levels? S is start, K is kill..what other things more? |
Quote:
For instance, an init script that follows this conventions have a small header that is used by chkconfig and fellows, to deal with the links in /etc/rc.d and runlevels. Postfix has the following header and as you can see, the information bellow informs the proper order and pre-requisites to this script. Code:
# And no, there is no other link type than the ones that start with "S" or "K". Another convenience on SuSe are the rccommands - they are easy to type and to autocomplete by your shell: In Suse, almost every init script can be start/stopped with the rccommands, i.e. rcpostfix start (or stop - there is also status and restart - in fact, is just a link from /sbin/rcpostfix to /etc/init.d/postfix - you can make the link yourself for adsm...) In Redhat/Fedora, you can do the same with "service postfix start". (I don't know if the above is under LSB conventions or not) cheers, |
i am sorry to say that but it did not work out..
it does not start after reboot.. i had to start it manually.. any further ideas? |
Please, give us the output of the following commands:
Code:
# runlevel |
before giving the outputs a quick question...
xinitrc file for the GUI responsible.. i mean the programs that i run via xinitrc file will be loaded only after i start KDE or GNOME..is this right? |
Code:
mfc-falter:~ # runlevel Code:
mfc-falter:/etc/X11/xinit # ls -l xinitrc Code:
# |
Quote:
|
i have compared the runlevels of adsm script with sshd and cupsd..
they are the same.. so the adsm should be started at the same level.. what could be wrong..? i could start the script manually.. |
I am guessing, but looks like the order for this adsm program is wrong. S01 is too soon; you don't have networking at this point, for instance.
If the program does not have the necessary pre-requisites it will fail at startup, but after the system boots up completely, it can run just fine. What this adsm program is supposed to do ? Where you have downloaded it ? How do you install this program ? By a rpm or a tar (configure;make;make install) ? Please, put the lines beetween ### BEGIN INIT INFO and ### END INIT INFO of the /etc/init.d/adsm so we can propose a better order for it. |
this adsm script is supposed to start the scheduler of "ibm tivoli backup sofware". It is written by the university of heidelberg where i work as a part-time student.
Quote:
i don't have these lines (###BEGIN INIT INFO etc..) in adsm script.. |
Quote:
For instance, /etc/init.d/postfix has the lines: Code:
### BEGIN INIT INFO Code:
# Anyway, you need to change when this script starts. Currently it starts at very beginning of runlevel 5 (S01) and I suggest you change it to start a bit later. In the above notation, anacron starts at position S95 of run levels 2, 3, 4 and 5 and ends at position K05 of the same levels. If your script follows that convention, edit it and change the position to S90 or something like that. run "chkconfig adsm off" before you edit the file, and "chkconfig adsm on" after you have edited it. Check the position of the links Snnadsm. If not, make the links manually: Code:
# rm /etc/init.d/rc5.d/S01adsm /etc/init.d/rc3.d/S01adsm |
Code:
mfc-falter:~ # find /etc -name "*adsm" in /var/log/boot.msg i search for string "adsm" . It could not be found. script has only these lines.. Code:
#!/bin/sh |
level 2 did not help..
when the adsm script is run, is gives outputs like "adsm is already running" or "adsm is started" etc..is there any log file in which this could be written so that i can read? |
NEW INFO HAS COME TO LIGHT!!!
Usage: /etc/init.d/ADSM {start|stop|restart} this was in the /var/log/boot.msg file.. mfc-falter:/etc/init.d/rc2.d # ./S21adsm Usage: /etc/init.d/ADSM {start|stop|restart} i need some sort of an start parameter..how can i add it to the adsm script? |
Quote:
Every script at /etc/init.d/rcn.d/S* is called to run as "/etc/init.d/rcn.d/Snnwhatever start" ...still thinking... |
Quote:
Create the link at /etc/init.d/rc5.d/S90adsm and I bet this time it will work. From my previous post there is a instruction to create the link at rc5.d, check it if necessary. |
Quote:
|
there were links on levels 3 and 5 but they didn't work. That's why i tried to place the links on the second level..
But now i know the problem..the script needs and start argument to start. As i posted in #22..i just don't know how to automate it with the start argument.. |
Quote:
Double check. Quote:
So I think is just a matter of create a link a run level 5. The command "ln -s /etc/init.d/adsm /etc/init.d/rc5.d/S90adsm" should work. |
Quote:
mfc-falter:/etc/init.d # chkconfig -l adsm adsm 0:off 1:off 2:off 3:on 4:off 5:on 6:off mfc-falter:/etc/init.d # find /etc -name "*adsm" /etc/adsm /etc/init.d/rc5.d/K21adsm /etc/init.d/rc5.d/S01adsm /etc/init.d/adsm /etc/init.d/rc3.d/K21adsm /etc/init.d/rc3.d/S01adsm Quote:
oh sorry, i missed that part.. Quote:
|
mfc-falter:/etc/init.d # ln -s /etc/init.d/adsm /etc/init.d/rc5.d/S90adsm
mfc-falter:/etc/init.d # rm /etc/init.d/rc5.d/S01adsm mfc-falter:/etc/init.d # find . -name "*adsm" ./rc5.d/K21adsm ./rc5.d/S90adsm ./adsm ./rc3.d/K21adsm ./rc3.d/S01adsm with these settings, it does not start after reboot..do i have the right to go out of my mind? :scratch: |
Quote:
You left a "/etc/init.d/rc3.d/S01adsm" behind. remove it and re-create the link in runlevel 3 in the proper position with "ln -s /etc/init.d/adsm /etc/init.d/rc3.d/S90adsm". If your current run level is 3 this is why it not worked at run level 3. And as I said in a previous post, stay away from runlevels 2 and 4. before you boot your machine, give me the output of the following commands: Code:
# runlevel Code:
# /etc/init.d/rc5.d/S90adsm stop |
Code:
mfc-falter:/etc/init.d/rc3.d # runlevel Code:
mfc-falter:/etc/init.d/rc3.d # find /etc/init.d -iname "*adsm" -ls i think there is a problem here... Code:
mfc-falter:/ # ps -ef | grep dsmc but when i start it manually and directly (not using the Snn files) Code:
mfc-falter:/etc/init.d # ./adsm start Code:
ln -s /etc/init.d/adsm /etc/init.d/rc3.d/S90adsm |
Well, at least the adsm links are ok now.
The strange is "/etc/init.d/adsm start" works and "/etc/init.d/rc5.d/S90adsm start" not, even it says "Starting ADSM scheduler...started - done." :scratch: I think the problem is not with the link anymore but with the script itself. In your post #20, you put a section of "/etc/init.d/adsm start" that says it is a "script is designed for Debian Linux" but you are using a openSuSE system, right ? Try to replace this debian script by an another one designed to SuSE. Check if there is a SuSE script in the package. Or you may try this one: Novell Cool solutions Make a copy of "/etc/init.d/adsm" in a safe place, just in case, and copy the new script over "/etc/init.d/adsm". The SuSE script in the above link follows the LSB conventions to be used with chkconfig. In this case, remove the links manually, and run "chkconfig adsm on; checkonfig --list adsm" and check if the proper links were created in the right places and position. Try to run by the link again. |
well i have replaced the script, set chkconfig adsm to off (which has deleted the links) .
Then i copied adsm to /etc/init.d/. set the file to mod 755. then i made chkconfig adsm on.. the script was on levels 3 on 5 on. but it still did not start on the boot.. here is a log of the terminal Code:
mfc-falter:~ # chkconfig -l adsm |
What you have done so far:
1) fixed the init script by the correct one, for SuSE systems. 2) fixed the links in the runlevels to run the init script at the right time (S09) Now we have to find the reason it not start by look for messages in log files. If you are using the init script provided by Novell Coll Solutions try to edit the section that call dsmc binary and change the null re-direction to a log file in /tmp instead. Change from: Code:
echo -n $"Starting $prog2: " Code:
LOG="/tmp/adsm-init.log" At boot time try to see if there are messages in console, it may help you too. |
before we try it with the script from novell a quick question..
in msdos there is this autoexec.bat..i have made a search for its linux relevant and i have landed on /etc/init.d/boot.local file (on suse) when i run this command on console Code:
mfc-falter:/ # /etc/init.d/adsm start Code:
mfc-falter:/ # ps -ef | grep dsmc then i try out smt. like this.. Code:
mfc-falter:/ # cd /etc/init.d/ what is the difference between these two commands? should i really use cd command in a script file? |
ok now it works..i believe i have "technically" what i wanted..please correct me if i am wrong..
Code:
mfc-falter:~ # ps -ef | grep dsmc first of all, the boot.local file; Code:
# /etc/init.d/boot.local Code:
myadsm |
Quote:
You can, for sure, put any commands in boot.local. The difference is it is not under the control of chkconfig so, you need to manually edit the file to activated or not the command in the next boot. In fact, the very first versions of unix/linux didn't have any other boot script but only a simple file where all commands are in, just like boot.local. In fact, even in nodays there are very tiny/small versions of unix-like system that have only one script executed at boot time, full of commands. In fact, nothing changed at all. After kernel is up it calls the process /sbin/init that calls the script /etc/init.d/boot. This script will call every /etc/init.d/rcN.d/Snnwhatever and after that /etc/init.d/boot.local. Quote:
|
Congratulations !
Quote:
Just to be sure, add the cd command at the beginning of adsm script, and remove it from boot.local and restore it via chkconfig. If it works, than it is really a bug - it runs only if the current dir is /etc/init.d/ for some reason.... best regards, |
All times are GMT -5. The time now is 05:16 AM. |