Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need help making a start/stop script... Post 302364975 by phpfreak on Saturday 24th of October 2009 08:49:25 PM
Old 10-24-2009
It would be something similar to a initd startup script.. Smilie

Code:
  #!/bin/sh
  
  case "$1" in
    start)
      #Not entirely sure of how I would loop this sequence w/o cron
      #Also, on second try and consecutive thereafter it needs to 
      #first check to make sure that at least two txt files reside
      #in the current directory.. I haven't implemented this yet here since
      #i'm not sure of how it would loop
        
        ./page4mod0.sh &&;
	./page4mod99.sh &&;
        sleep 45;
        ;;
     #Not sure how to approach this part.. i could have it diff'd then compared in a temp file
     #or throw them into variables then compared.. think i'd prefer memory here though so let's try..
          A=`head -n4 pagemod.txt`
          B=`head -n4 pagemod0.txt`
           if [ "$A" = "$B" ]
           then #Do nothing
           echo >dev/null
           else 
          C=`head -n5 pagemod.txt`
          D=`head -n5 pagemod0.txt`
           mail@user@home.com -f `echo "$C -----  $D" > mailer.txt ;cat pagemod.txt >> mailer.txt ; cat pagemod0.txt >> mailer.txt`
          fi
        ;;
    stop)
        echo -n "Shutdown and cleanup"
        kill -9 page4mod0.sh;
        kill -9 page4mod0.sh;
	rm *.html *.txt;
        ;;
    restart)
        #This isn't entirely necessary now but it would be nice if i could tell it
	#to run the stop sequence.. wait.. then start it back up again.. later

    status)
        # Again not entirely necessary but just check for process other than 
	#the current and report pid
        ;;
    *)
        ## If no parameters are given, print which are avaiable.
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
        ;;
esac


Last edited by phpfreak; 10-24-2009 at 10:34 PM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Start/Stop Script

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)
Discussion started by: jjv1
2 Replies

2. UNIX for Dummies Questions & Answers

Making a Script to Start as a Service

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)
Discussion started by: S.Vishwanath
3 Replies

3. Shell Programming and Scripting

Start Stop Restart

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)
Discussion started by: Bakes
7 Replies

4. Shell Programming and Scripting

Help with stop/start Shell Script.

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)
Discussion started by: venga
1 Replies

5. UNIX for Dummies Questions & Answers

Why does fibonacci sequence script stop making sense at 92nd iteration?

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)
Discussion started by: DeCoTwc
8 Replies

6. Solaris

Stop/start script problem on Solaris-10

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)
Discussion started by: solaris_1977
6 Replies

7. Shell Programming and Scripting

Shell Script for Websphere MQ Queue Manager start/stop

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)
Discussion started by: pady1224
3 Replies

8. Shell Programming and Scripting

Shell script to stop and start server

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)
Discussion started by: rcroyal88
1 Replies
X2SYS_MERGE(1gmt)					       Generic Mapping Tools						 X2SYS_MERGE(1gmt)

NAME
x2sys_merge - Merge an updated COEs tables SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had to recompute only the COEs between the edited files and the rest of the database. -A Specify the file main_COElist.d with the main crossover error data base. -M Specify the file new_COElist.d with the newly computed crossover error data base. OPTIONS
No space between the option flag and the associated arguments. EXAMPLES To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1) GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy