LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 08-17-2007, 11:21 AM   #1
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Rep: Reputation: 34
Starting a self-built process at boot time


Hi.

I did a bit of Googling around but was not able to find a suitable answer, so here goes...

I compiled OpenSSH for Solaris 2.7. The "uname -a" commands yields the following.
Code:
SunOS sparc-dual7 5.7 Generic_106541-20 sun4u sparc SUNW,Ultra-250
I am now able to run sshd by simply execting the command as follows:
Code:
/usr/local/sbin/sshd -f /usr/local/etc/sshd_config
So far, so good. Now what I'd like to do is include the command as part of the startup process so the sshd daemon starts automatically at bootup. It would be as simple as adding the command to /etc/rc.local under Linux, but there's no such file under Solaris. There are a bunch of /etc/rc* directories where different startup scripts are stored depending upon the runlevel, but I'm not sure I should mess with them manually.

Any help would be appreciated.

TIA,
Dai
 
Old 08-17-2007, 04:28 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Put your start script in /etc/rc3.d/S99sshd
 
Old 08-29-2007, 06:20 PM   #3
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
Talking

Make sure your script has a

Code:
case "$1" in

start) (your command)

;;

stop) 

;;

esac
Or something of the like or it wont start
 
Old 08-29-2007, 07:09 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I'm sorry to tell it will start even without that. The rc launcher does not parse the scripts expecting a structure, it just executes them.

Of course, using such a construction is more elegant, is the usual way it is done and allows to enhance the script to stop the service too.

Last edited by jlliagre; 08-31-2007 at 12:40 AM.
 
Old 08-30-2007, 06:57 PM   #5
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
Really ? I always thought that it passed "start" to all the S ones and stop to all the K ones ?

From /etc/init.d/README

"File names in rc?.d directories are of the form [SK]nn<init.d filename>
where 'S' means start this job, 'K' means kill this job, and 'nn' is the
relative sequence number for killing or starting the job. When
executing each script in one of the /etc/rc[S0-6] directories, the
/sbin/rc[S0-6] script passes a single argument. It passes the argument
'stop' for scripts prefixed with 'K' and the argument 'start' for
scripts prefixed with 'S'. There is no harm in applying the same
sequence number to multiple scripts. In this case the order of
execution is deterministic but unspecified. It is recommended that
scripts be hard-linked from the same file stored in /etc/init.d/."

But I could be wrong

Last edited by ADxD_7; 08-30-2007 at 07:03 PM.
 
Old 08-30-2007, 07:14 PM   #6
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 36
Yes, that's true. But it's also true that one script that receives whichever parameter can just ignore it: one thing is receiving, another thing is using.

Besides, if you respect that structure you can write only one script to start, stop, restart, etc. and using that parameter to switch between behaviours.

Bye,
Enrico.
 
  


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
Add a process at boot time overlook1977 Slackware 4 05-26-2007 01:44 PM
"Starting System Logger" during boot time, stopping boot process. quickNitin Linux - Newbie 1 06-08-2006 01:31 PM
Starting program during boot-process with option to do not so ... ruh31 Debian 6 02-10-2006 01:41 AM
starting sendmail at boot (when built from source!!!!) zepplin611 Linux - Newbie 1 07-13-2004 04:01 PM
starting a background process running tcpdump on boot butthead Linux - Networking 1 10-15-2003 06:34 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

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