Solved

startup and nightly scripts

Posted on 2007-04-03
2
479 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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…
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.

895 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

15 Experts available now in Live!

Get 1:1 Help Now