you need a PATH statement at the start of your script with the directories of all the external programs you are going to call from your script
call your own scripts and files you manipulate using absolute paths, not relative paths
depending on your intention either:
- use & instead of && for background processing followed by a wait statement after the sleep statement
- use && operator to start processes only when previous command succeeds but then loose the semicolons
do not use kill -9 unless you have to . Use kill first and then check. If not successful use other kill options or move directly on to kill -9.
use a colon ( : ) as an idle statement instead of echo>/dev/null or use [ "$A" != "$B" ]
You might want to brush up the mail command
You can not kill processes, you need process id's (pids). Either save those at the start of a process in a tmp file or distill it from ps -ef
You probably want to put all the statements either in a wrapper script or a function that contains the 45 second loop with the script calls, the comparison and the mail section and that you start perpetually in the background using:
nohup /path/to/wrapperscript &
The stop start script then just stops/starts/status checks that wrapper script
you can create a perpetual loop using
for the restart option you can use:
Use exit statements to indicate error levels
Enough for now, have fun!
Last edited by Scrutinizer; 10-25-2009 at 06:41 AM..
I'm a newbie to the Unix world Help!
I have to maintain a host of Sybase database servers sitting on Unix Sun Solaris 8...I've been tasked with finding/creating a way to auto start/stop Unix via unix commands, specifically when the Unix servers need to be restarted we want Sybase to start... (2 Replies)
Hi,
I have a shell script t1.sh. on my solaris box.
So, what are the steps required to make this script run as a Service, when the system re-starts. (for ex:- at run level 3).
I know that I should use the rc.d folders. But I don't know the exact steps.
Kindly explain,
Thanks in... (3 Replies)
I'm wondering how I should make a script that can start, stop, and restart another script.
What I need to be able to do, is start and stop a perl script from the command line. The easiest way of doing this seems to be to have another script, starting and stopping the other script. I have BASH,... (7 Replies)
Hi All,
I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task.
1. User will input the option which server they wish to stop.
2. Will clear cache files from specific location.
3. ... (1 Reply)
So, Just for practice, I wrote a simple fibonacci sequence script in bash.
(03:08:02\$ cat fib
#!/usr/bin/bash
ret ()
{
echo -ne "\n"
sleep .5
}
a=1
b=2
echo -n $a #1 A
ret
echo -n $b #2 B
ret (8 Replies)
I have Big brother script, which start/stop Big Brother processes. Something got change on server and now I am not able to start/stop it. There is no change in script, as I compared it from other server. This service is being managed by bb user (group is also bb).
root@tsazdq04:/#... (6 Replies)
Hello All,
I am completely new to shell scripting. I had to write a script that starts and stop the queue manager in Websphere MQ. We are on Linux 64-bit patform.
The script should stop the queue manager and all the processes related to websphere MQ. It should be a clean stop. Once the queue... (3 Replies)
Hi,
I need to create a shell script for automated server patching, with the following scenario:
I have two Linux servers Primary and secondary.
Server patching should start on Primary 1st and then secondary.
1st check both servers are up and running.
Then stop primary and patching will... (1 Reply)