LinuxQuestions.org
Visit Jeremy's Blog.
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 10-16-2007, 04:54 AM   #1
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124
Blog Entries: 2

Rep: Reputation: 15
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..
 
Old 10-16-2007, 06:20 AM   #2
larkl
Member
 
Registered: Sep 2007
Distribution: Puppy 5.2.8
Posts: 69

Rep: Reputation: 15
I don't use SUSE, but you might try their forum...

http://forums.suselinuxsupport.de/in...howtopic=52444
 
Old 10-16-2007, 06:54 AM   #3
selva146
Member
 
Registered: Oct 2007
Location: INDIA
Distribution: Rehat, Fedora, RHEL
Posts: 47

Rep: Reputation: 15
in redhat and fedora, you can put the script command in /etc/rc.local file

each and every restart this file gets executed
 
Old 10-16-2007, 06:57 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
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
-rwxr-xr-x 1 root root 2401 2007-06-14 07:29 /etc/init.d/postfix
lrwxrwxrwx 1 root root   17 2007-06-13 09:51 /etc/rc5.d/S80postfix -> ../init.d/postfix
[root@agente86 ~]#
So, if you have a complex script, let say mybackup, put it on /etc/init.d and create links on /etc/rc5.d (or /etc/rc3.d) with a name like "S91mybackup". This script must be executable (-rwx) and it expects an argument "start|stop|status". If this script follows the LSB, you can use the command "chkconfig myscript on/off" to automatically create/destroy the links in the appropriate order and run-level.

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.
 
Old 10-18-2007, 05:07 AM   #5
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
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/
mfc-falter:/etc/init.d # ps aux | grep dsmc
root      4149  0.0  0.5  22640  4948 ?        Sl   12:01   0:00 /opt/tivoli/tsm/client/ba/bin/dsmc schedule
root      4244  0.0  0.0   4100   708 pts/0    S+   12:02   0:00 grep dsmc
mfc-falter:/etc/init.d # ./adsm stop
Stopping ADSM scheduler...
...stopped
mfc-falter:/etc/init.d # ps aux | grep dsmc
root      4252  0.0  0.0   4100   708 pts/0    S+   12:02   0:00 grep dsmc
mfc-falter:/etc/init.d # ./adsm start
Starting ADSM scheduler...
...started - done.
mfc-falter:/etc/init.d # ps aux | grep dsmc
root      4258  3.0  0.5  22636  4948 pts/0    Sl   12:02   0:00 /opt/tivoli/tsm/client/ba/bin/dsmc schedule
root      4261  0.0  0.0   4100   708 pts/0    S+   12:02   0:00 grep dsmc
mfc-falter:/etc/init.d # cd rc3.d/
mfc-falter:/etc/init.d/rc3.d # ls -l K21adsm 
lrwxrwxrwx 1 root root 7 Oct 16 12:26 K21adsm -> ../adsm
mfc-falter:/etc/init.d/rc3.d # cd ..
mfc-falter:/etc/init.d # cd rc5.d/
mfc-falter:/etc/init.d/rc5.d # ls -l K21adsm 
lrwxrwxrwx 1 root root 7 Oct 16 12:26 K21adsm -> ../adsm
mfc-falter:/etc/init.d/rc5.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..
 
Old 10-18-2007, 05:31 AM   #6
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
Quote:
Originally Posted by laucian View Post
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.
By "restart" I presume you talking about a reboot of this computer, right ?
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.

Last edited by marozsas; 10-18-2007 at 05:35 AM.
 
Old 10-18-2007, 05:53 AM   #7
janardhan narra
LQ Newbie
 
Registered: Oct 2007
Location: hyderabad
Posts: 1

Rep: Reputation: 0
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
 
Old 10-18-2007, 06:02 AM   #8
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
Quote:
Originally Posted by janardhan narra View Post
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
Start your own thread (New Thread button on top of forum's page) to get the maximum visibility and provide as much information you can at the first post. Tell us what computer is (mobo manufacture, disk model, etc) and what distro are you using to install.
 
Old 10-18-2007, 07:51 AM   #9
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
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*
lrwxrwxrwx 1 root root 7 Oct 18 14:43 K21adsm -> ../adsm
lrwxrwxrwx 1 root root 7 Oct 18 14:43 S01adsm -> ../adsm

mfc-falter:/etc/init.d/rc3.d # ls -l *adsm*
lrwxrwxrwx 1 root root 7 Oct 18 14:43 K21adsm -> ../adsm
lrwxrwxrwx 1 root root 7 Oct 18 14:43 S01adsm -> ../adsm
i am unfortunately not in the office..i have done this remote..
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?
 
Old 10-18-2007, 09:21 AM   #10
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
Quote:
Originally Posted by laucian View Post
thanks marozsas,
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?
LSB means "Linux Standard Base" and it is a set of conventions to make easier the administration tasks on a linux box, whatever the distro is.

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:
#
# /etc/init.d/postfix
#
### BEGIN INIT INFO
# Provides:       sendmail postfix
# Required-Start: $network $named $syslog $time
# Should-Start: cyrus ldap ypbind openslp
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    start the Postfix MTA
### END INIT INFO
You can find more information on LSB's site.

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,
 
Old 10-23-2007, 02:37 AM   #11
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
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?
 
Old 10-23-2007, 05:19 AM   #12
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
Please, give us the output of the following commands:
Code:
# runlevel
# cat /etc/issue
# chkconfig adsm 
# chkconfig --list adsm
# ls -l /etc/init.d/adsm
# find /etc -type l -iname "*adsm"
 
Old 10-23-2007, 05:32 AM   #13
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
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?
 
Old 10-23-2007, 05:39 AM   #14
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
Code:
mfc-falter:~ # runlevel
N 5

mfc-falter:~ # cat /etc/issue

Welcome to openSUSE 10.2 (X86-64) - Kernel \r (\l).


mfc-falter:~ # chkconfig adsm
adsm  on
mfc-falter:~ # chkconfig --list adsm
adsm                      0:off  1:off  2:off  3:on   4:off  5:on   6:off

mfc-falter:~ # ls -l /etc/init.d/adsm
-rwxr-xr-x 1 root root 1232 Oct 16 12:16 /etc/init.d/adsm
mfc-falter:~ # find /etc -type l -iname "*adsm"
/etc/init.d/rc5.d/K21adsm
/etc/init.d/rc5.d/S01adsm
/etc/init.d/rc3.d/K21adsm
/etc/init.d/rc3.d/S01adsm
and there is a modification that i have made..i think i should add that one here too..in this file,
Code:
mfc-falter:/etc/X11/xinit # ls -l xinitrc
-rwxr-xr-x 1 root root 1388 Oct 23 12:29 xinitrc
i just added..
Code:
#
# Add your own lines here...
#
/etc/init.d/adsm start
 
Old 10-23-2007, 05:52 AM   #15
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,503
Blog Entries: 2

Rep: Reputation: 68
Quote:
Originally Posted by laucian View Post
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?
no, not really. xinitrc run commands when the graphical mode starts, like the Graphical Display Manager, the login manager...
 
  


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
A lot of processes run automatically when I run a single process. dalvirgautam Linux - Enterprise 4 12-01-2006 06:10 PM
Viewing and setting processes to run on startup? Infernal211283 Linux - General 3 04-24-2006 07:38 AM
Processes on startup EclipseAgent SUSE / openSUSE 2 11-24-2005 03:48 AM
About startup processes kejia Fedora 2 11-09-2005 07:38 PM
Too many sleeping processes on startup? slugfish Linux - General 5 10-24-2003 03:04 PM

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

All times are GMT -5. The time now is 02:40 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