Announcement

Collapse
No announcement yet.

script that stop service

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • script that stop service

    hi everyone,
    im looking for script that stop service before the backup and start him after the backup where i can find that or how i can make it? and how im turn him on
    thnx

  • #2
    Re: script that stop service

    Obtain the servicename via the properties of the service,

    Code:
    :: Stop Service ( McShield )
    @sc start McShield && @net stop McShield
    
    ::Run backup
    rem  What backup program you using?
    
    :: Start Service ( McShield )
    @sc stop McShield && @net start McShield
    Is the backup program that you are using also backingup data on remote computers?


    \Rems
    Last edited by Rems; 21st April 2009, 11:53.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: script that stop service

      i use backup excec for backup i have schedule i want that the service stop at 20:00 and start at 5:00
      but i dont how to write this i dont have a lot of experience so i will be glade if you explain me step by step
      thanx again

      Comment


      • #4
        Re: script that stop service

        You can configure in the backup job to start a script before the backup starts.
        And configure to run a script after the job is ended. Therefore you have to split the sample batch into a separate "Stop Service.cmd" and "Start Service.cmd" batches.

        Note, this simple sample batch cannot stop the services on remote computer you might also want to backup.
        It is possible however to write a batch that willl stop the service on all computers listed.


        \Rems

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: script that stop service

          but i dont know how to write that and the backup is work on 3 servers
          and the service that i want to stop is not on the server that backup exec is installed on

          Comment


          • #6
            Re: script that stop service

            StopService.cmd
            Code:
            @echo off
            SetLocal
            
            Set $Service=McShield
            
            Set $Title=Stopping '%$Service%' on:
            Set $Computers=%computername%, Server2, Server3
            
            For %%! in (%$Computers%) Do (
              echo\%%!
              start "%$Title% \\%%!"/Min SC.exe \\%%! STOP "%$Service%"
            )
            EndLocal
            echo on
            StartService.cmd
            Code:
            @echo off
            SetLocal
            
            Set $Service=McShield
            
            Set $Title=Starting '%$Service%' on:
            Set $Computers=%computername%, Server2, Server3
            
            For %%! in (%$Computers%) Do (
              echo\%%!
              start "%$Title% \\%%!"/Min SC.exe \\%%! START "%$Service%"
            )
            EndLocal
            echo on
            \Rems
            Last edited by Rems; 21st April 2009, 13:30.

            This posting is provided "AS IS" with no warranties, and confers no rights.

            __________________

            ** Remember to give credit where credit's due **
            and leave Reputation Points for meaningful posts

            Comment


            • #7
              Re: script that stop service

              wow man i think that you want to help me and im sure that what you wrote
              below is need to help me
              but i dont know what to do with that
              where i need to write this? where i need to write my details? (service,time)
              im sorry that i ask you many question or maybe raving you but im really dont know. sorry

              Comment


              • #8
                Re: script that stop service

                Are you running the job from command? or have you created and scheduled a job via the backup exec gui?

                Here you can find information about configuring "Pre/Post Commands":
                http://www.google.com/search?q=%2B%2...&hl=&btnG=&lr=
                Place the scripts in a path on the server were backup exec is installed on.

                If the backup job is executed by command line, in that case merge the two sample scripts again and place the back-up command line between the two.


                \Rems

                This posting is provided "AS IS" with no warranties, and confers no rights.

                __________________

                ** Remember to give credit where credit's due **
                and leave Reputation Points for meaningful posts

                Comment


                • #9
                  Re: script that stop service

                  i crated job scheduled via backup exec gui
                  o.k i understood how to add command prompt now i need to create the command
                  where i can find script or guide ? because i dont know how to create
                  thank you a lot!

                  Comment


                  • #10
                    Re: script that stop service

                    You can use the samples from my reply,
                    just enter in the batch the names of the two other servers.


                    where i can find script or guide ?
                    Help on creating your own batch scripts

                    - Help file 'Command-line reference': c:\windows\help\ntcmds.chm

                    helpfull links:
                    - Information on batch files, http://www.computerhope.com/batch.htm
                    - Using batch files, http://technet.microsoft.com/en-us/l.../bb490869.aspx
                    - Command-line reference A-Z, http://technet.microsoft.com/nl-nl/l...71(en-us).aspx
                    - Batch Files & Batch Commands, http://www.robvanderwoude.com/batchcommands.php


                    \Rems

                    This posting is provided "AS IS" with no warranties, and confers no rights.

                    __________________

                    ** Remember to give credit where credit's due **
                    and leave Reputation Points for meaningful posts

                    Comment


                    • #11
                      Re: script that stop service

                      im sorry but im not sure how to that
                      i dont know where to fill the details

                      Comment


                      • #12
                        Re: script that stop service

                        Originally posted by M-Be View Post
                        im sorry but im not sure how to that
                        i dont know where to fill the details
                        The details are (CMIIAW) just:
                        - the netbios names of the three servers
                        - the name of the Service that is running on the servers.

                        The blue colored text in my sample batches are the variables, repace just the blue text w/ your details.

                        The "StopService.cmd" batch (you should enter the full path to the batch at the pre-Commands box) is for stoping the service on the servers. The other "StartService.cmd" batch (you should enter the full path to the batch at the post-Commands box) is for starting the service again.

                        Just try by editing the batches and run them manualy for testing.
                        Show a sample of your batch when it didn't work.


                        What account is used to launch the backup exec backup job?


                        \Rems
                        Last edited by Rems; 23rd April 2009, 16:01.

                        This posting is provided "AS IS" with no warranties, and confers no rights.

                        __________________

                        ** Remember to give credit where credit's due **
                        and leave Reputation Points for meaningful posts

                        Comment

                        Working...
                        X