Solved

startup and nightly scripts

Posted on 2007-04-03
2
474 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how do I change a ip address on a unix box 13 37
sort command HPUX 11 53
AIX  NFS  question 5 89
Problem logging tar errors 11 35
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now