Solved

startup and nightly scripts

Posted on 2007-04-03
2
480 Views
Last Modified: 2013-12-27
Hi.
I'm using Solaris 10, and having trouble finding out how to start something after boot the correct way.
As root I need to run /opt/glassfish/bin/asadmin start-appserv after reboot.
Any ideas how I can do this.

I allso need to do /opt/glassfish/bin/asadmin restart-appserv every night. Anyone who knows how?
0
Comment
Question by:kristian_gr
2 Comments
 
LVL 4

Expert Comment

by:vamsi_uk
ID: 18843601
to schedule a job everynight you need to use cron jobs. please refer to the following link for good explanation on how to setup cron job.

http://adminschoice.com/docs/crontab.htm

If you need to start your application at boot time you need to put a startup script at run level scripts which are also known as rc scripts.

Here is how you can add the script to run at boot time,

to start a script at run level 2...

1. Become Superuser

2. Add the script to the /etc/init.d directory
# cp <filename>  /etc/init.d
# chmod 0744 /etc/init.d/<filename>
# chown root:sys /etc/init.d/<filename>

3. Create links to the appropriate rc<n>.d   where n is the number of the level
# cd /etc/init.d
# ln <filename> /etc/rc2.d/S<filename>
# ln <filename> /etc/rc<n>.d/K<filename>   <-- this is your kill script while system is shutdown

4. Use the ls cocmmand to verify that the script has links in the specified directories
# ls -l /etc/init.d/  /etc/rc2.d  /etc/rc<n>.d
thats it.. Whenever you are booting the system the script will run when the Operating system enters in run level 2.
0
 
LVL 22

Accepted Solution

by:
blu earned 500 total points
ID: 18844049
Actually, for Solaris 10 and above, the proper way to start services at boot time is to use SMF. Although the startup scripts in the rc?.d directories are still run, this is called "legacy support" and
are deprecated.

SMF is a little trickier to get up to speed, but they offer quite a few advantages, including automatic restart of a service if the daemon crashes.

I notice you are using glassfish. Glassfish comes with SMF support built in. I am not an expert on Glassfish, but my understanding is that you can use the asadmin command to create the SMF service. After that all you have to do is enable it.

I did come across this URL that talks about it. I cannot guarantee that this still works exactly as described, since the article is a year old. However, it should have something about this in the Glassfish documentation.

http://blogs.sun.com/bloggerkedar/entry/app_server_and_solaris_10
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now