Solved

autorun user scripts

Posted on 2001-07-10
9
555 Views
Last Modified: 2013-12-27
In linux , I can add script in rc.local so that it can run automatically when system boot up.

How about in solaris ? I cannot find such file
0
Comment
Question by:adrianmak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 4

Expert Comment

by:Otetelisanu
ID: 6272193
In Solaris is for
System up in /etc/rc2.d
for System down in /etc/rc0.d.

For System down only with
shutdown.
With reboot the system not start
the files in /etc/rc0.d
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6273469
do you mean to run the scripts each time the system boots, or just when a specific user logs on?
0
 
LVL 4

Expert Comment

by:Otetelisanu
ID: 6275819
In Solaris for user logs on
is 2 file.
1.- /etc/profile (For all users)
2.- $HOME/.profile (sh and ksh schell) for
     single user.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 6276279
> 1.- /etc/profile (For all users)

NO.

Not for users using other shell than ash, bash, bsh, esh, jsh, ksh, lsh, msh, pdksh, rksh, rsh(HP-UX only), sh, tsh, (and probably some more), as login shell.
0
 
LVL 4

Expert Comment

by:Otetelisanu
ID: 6276522
yes OK!
I write as example
for ksh and sh
0
 

Author Comment

by:adrianmak
ID: 6279385
I am not talking about user profile
but system auto run user scripts when system bootup
0
 
LVL 1

Accepted Solution

by:
shanechambers earned 5 total points
ID: 6279426
I believe Otetelisanu's original answer was correct, but a little confusing, and not complete.

In Solaris (and any System 5 type Unix) what you need to do is add a file that contains what you want to happen, in the /etc/rc[1-3].d directories.  The name of the file determines if the script is for startup or shutdown, and what sequence it's ran in.

File naming breakdown:
(S|K) (Sequence Number) (topic)

For example:
/etc/rc3.d/K99apache

Would be a KILL script for apache.  Note that the kill scripts 1-98 will run BEFORE this one will.

For example:
/etc/rc3.d/S99apache

Would be a STARTUP script for apache.  Again, 1-98 will run before this one will.

As far as directories go, they differ for usage;
/etc/rc1.d     system administrator mode
/etc/rc2.d     multi-user mode (mostly system apps)
/etc/rc3.d     Extend multi-user mode (user apps)
/etc/rc4.d     alternative multi-user mode

The best way to set all of this up is to write your Start, and Kill script as one file, using a case $1 at the top.  When the system is starting up, or shutting down, and it runs the scripts, it will pass either "start" or "stop" to the script, which can be viewed as $1 (in sh, and ksh).

Once you have the script written, store it in /etc/init.d, and make symbolic links (ln -s) to it, from the directories that you want it to run.  For example;

From the /etc/rc3.d directory:
ln -s /etc/init.d/apache S99apache

This helps keep everything organized, and easier for the next person that has to change it.

Hope this helps!
Shane
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6279778
how about reading  /etc/init.d/README
It describes all you need to know ;-)
0
 
LVL 1

Expert Comment

by:shanechambers
ID: 6279978
>how about reading  /etc/init.d/README

I never knew that file exsisted! (probably because I started on old AT&T System 5 ;)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
nodeip 9 92
Move nodes from one TSM to another. 3 95
Where to get php 5.6 for AIX 7.1? 5 133
aix tls version 6 555
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question