Running a program/batch as a service

Home Forums Server Operating Systems Windows Server 2000 / 2003 / 2003 R2 Running a program/batch as a service

Viewing 1 post (of 1 total)
  • Author
    Posts

  • humbletech99
    Member
    #129277

    I added a windows service to run a custom program which is called from a batch file. So I added the service using sc and created it properly (I have done this before for other programs so I know the syntax).

    The problem I have is in starting the service, I always get the error:

    Code:
    The service did not respond to the start or control request in a timely fashion.

    Talk about an annoying and generic error…

    I have checked the program path and args are valid, even tried several different incarnations of it. Every incarnation works if run from cmd. The command line is:

    Code:
    d:dir1dir2start_program.bat

    where the batch simply does a cd into it’s current directory and then runs another program in that directory.

    The exact line given above works, I have even changed user accounts to get it to work, let it run as the system account, but the same result. If I runas the above command it works, so the account details cannot be wrong or have permissions problems.

    The thing bails out with an error immediately.

    The batch is written to run in the foreground, not to fork and not to exit unless the service exits and then it reaches the end of the batch file.

    All I can think of is that it is not valid to try to run a batch file as a service.

    Does it take a special kind of program to run as a service, perhaps one that responds to certain system calls or something?
    Or is there some similar limitation about the type of program or the stucture of a program that would stop it running as a service?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

13 Email Threat Types to Know About Right Now

As email threats evolve and multiply, keeping track of them all—and staying protected against the many different types—becomes a complex challenge. Today, that requires more than just the traditional email gateway solution that used to be good enough.

In this eBook you will learn:

  • What are the most common and challenging email attacks for organizations?
  • How to defend against sophisticated email threats, such as spoofing, social engineering, and fraud
  • How to protect employees at the inbox level with the right technologies and security-awareness training
  • How to use a multilayered protection strategy to reduce susceptibility to email attacks and better defend your business and employees

Sponsored by: