[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

startup and nightly scripts

Posted on 2007-04-03
2
Medium Priority
?
489 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
[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
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses

650 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