Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 133
  • Last Modified:

simple service

Hi,

I have a batch file that I have to run ON the server, in order to compile some code, whenever I change the code.  In order to do this, I have to TS into my W2K server and run the batch file.  Is there any way I can just make my batch file a service or something that I can run remotely?  The batch file has to run from a certain directory on the server, and I don't want to share that directory, so I can't just run the batch from my work station.  It looks like this:

cd "F:\inetpub\wwwroot\services\aspnetstore\Components"
F:
csc /t:library /out:../../../bin/Ccmtees.dll localFilesHere.ext

.. more commands here ...


thanks

Trevor
0
trevorhartman
Asked:
trevorhartman
  • 4
  • 3
1 Solution
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
You could use the scheduled tasks control panel and schedule it to run periodically.  A service is typically something that runs all the time.  You want the code CONSTANTLY recompiled?  Doing so might lock the file your trying to program/edit.  I'd say go with the scheduled task.  Run it every 5 minutes if you want, but don't make the batch file a service per se or you may have MANY problems trying to use it.

0
 
trevorhartmanAuthor Commented:
as you can probaly tell i don't really know what i'm talking about :)

I only need to compile my code RIGHT after I edit it... So I don't want to make it a service.  I would like to make it into something that I could just run from the commmand line on my workstation.. is there some kind of net start syntax or something that could tell the server to run the batch?
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
If you really want to make it a service, look into srvany - an NT resource kit utility that I'm all but certain is available/included for Windows 2000.

http://www.winnetmag.com/Windows/Article/ArticleID/8148/8148.html
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
trevorhartmanAuthor Commented:
well I don't really want to make it into a service, if that's not the right way to go..  i mean, what do you recommend?  I'm telling you what I need - the ability to run something on the server by typing a command on my workstation..  Does that require making a service, or is there an easier way?
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Ok, so you want to edit the program on your workstation, then have your workstation kick off the script on the server so that you don't have to terminal in, right?
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Try downloading the free PSTOOLS from www.sysinternals.com.  One of the tools included is "PSEXEC" - here's some info about it:


PsExec v1.55 - Execute processes remotely
Copyright (C) 2001-2004 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.

Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-s|-e][-i][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...] cmd [arguments]
     -a         Separate processors on which the application can run with
                commas where 1 is the lowest numbered CPU. For example,
                to run the application on CPU 2 and CPU 4, enter:
                "-a 2,4"
     -c         Copy the specified program to the remote system for
                execution. If you omit this option the application
                must be in the system path on the remote system.
     -d         Don't wait for process to terminate (non-interactive).
     -e         Loads the specified account's profile.
     -f         Copy the specified program even if the file already
                exists on the remote system.
     -i         Run the program so that it interacts with the desktop on the
                remote system.
     -n         Specifies timeout in seconds connecting to remote computers.
     -p         Specifies optional password for user name. If you omit this
                you will be prompted to enter a hidden password.
     -s         Run the remote process in the System account.
     -u         Specifies optional user name for login to remote
                computer.
     -v         Copy the specified file only if it has a higher version number
                or is newer on than the one on the remote system.
     -w         Set the working directory of the process (relative to
                remote computer).
     -priority      Specifies -low, -belownormal, -abovenormal, -high or
                -realtime to run the process at a different priority.
     computer   Direct PsExec to run the application on the remote
                computer or computers specified. If you omit the computer
                name PsExec runs the application on the local system,
                and if you specify a wildcard (\\*), PsExec runs the
                command on all computers in the current domain.
     @file      PsExec will execute the command on each of the computers listed
                in the file.
     program    Name of application to execute.
     arguments  Arguments to pass (note that file paths must be
                absolute paths on the target system).

You can enclose applications that have spaces in their name with
quotation marks e.g. psexec \\marklap "c:\long name app.exe".
Input is only passed to the remote system when you press the enter
key, and typing Ctrl-C terminates the remote process.

If you omit a user name the process will run in the context of your
account on the remote system, but will not have access to network
resources (because it is impersonating). Specify a valid user name
in the Domain\User syntax if the remote process requires access
to network resources or to run in a different account. Note that
the password is transmitted in clear text to the remote system.

Error codes returned by PsExec are specific to the applications you
execute, not PsExec.
0
 
trevorhartmanAuthor Commented:
looks good, thanks for the reference

-Trevor
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now