24x7 Script Archive

Free command line utilities

BindCPU If you run applications on a multiprocessor machine, you can use this utility to bind a particular application to a particular CPU or subset of available CPUs. By binding different applications to different CPUs you can greatly optimize your application performance.
BindDesktop Using this utility you can run different applications on different virtual desktops. For example if you run 24x7 Scheduler in Windows NT service mode (Windows NT/2000/XP/2003/Vista runs all services on the invisible services desktop), you can use BindDesktop to run a process on a visible user Desktop allowing users to see and interact with the process. By default all child processes always run on the desktop where the parent process is started. BindDesktop is a solution for this issue.
SetPriority Change process priority of a running process. This utility can be used on Windows NT/2000/XP/2003/Vista systems.
FileCopy DOS copy command, Windows Explorer file copy operations, JAL's FileCopy statement, VBScript's CopyFile method, Windows API FileCopy functions; all of them have the same common deficiency - they lock files during file copy operations. As a result, you can experience various file sharing problems if you schedule multiple jobs that access the same file. The FileCopy utility allows non-locking file copying as well as partial and incremental file copying.
LineCount Use LineCount to count lines in your source code files or use it to verify integrity of your data files.
LineCopy This utility provides for Windows what head and tail utilities provide for Unix systems. LineCopy performs line-based copying of text files allowing one to copy and extract portions of a text file or cut a text file into pieces. Files are copied in shared read-write mode so that they can be accessible for read and update by other programs during LineCopy processing.
FileDir This multi-file processor utility extends functionality of the DOS dir command. Two main extensions:
1. File date and age filters (for example, you can find files that are older than N number of days)
2. Automatic processing of each found file by a program of your choice (for example, to delete all log files from a particular directory that are more that 30 days old, you can run FileDir /C cmd /P "/c del " /A 30 /N *.log ).
FileTouch Windows keeps track of the date and time every file was created, and of the date and time it was last modified or accessed, but it does not provide ways for changing file dates and times manually without modifying the actual files. FileTouch is a command line utility that allows you to change them. It is similar in functionality to the well-known UNIX touch command.
FileTruncate FileTruncate can delete contents of existing files without deleting the actual files. It can even truncate files being opened in other applications.
RunOne RunOne provides methods for limiting an application to a single instance. Just use RunOne my_application.exe my parameters to run your application and it will ensure that only one instance of the application is run at a time. If another instance is already running, RunOne simply aborts without starting a new instance. If you want to kill the previous instance, you may want to use the KillProcess utility. In addition, RunOne can be used to run applications in hidden or minimized windows.
KillProcess KillProcess can be used to quickly close or terminate single or multiple running processes.
RunAs RunAs is a command line utility that can be used to run a program under different user account. It is similar to the Windows 2000/XP/2003/Vista native RunAs utility, but it has some distinct features making it more usable then the native version. For example, it accepts password as a command line parameter so that it can be used in batch files; it can also bind started process to the interactive user Desktop so it can be used to start interactive processes from various services such as 24x7 Scheduler, 24x7 Event Server and other.
Logon Use Logon utility to schedule Desktop unlocks on Windows NT/2000/XP/2003/Vista systems. This utility should be run when the system is locked and before running other processes requiring simulated user input (using SendKeys or 24x7 MacroRecorder scripts).
FileBinReplace FileBinReplace allows multi-file search and replace operations in binary files. FileBinReplace is very fast and can process multiple files described by a file mask. Just as other utilities, it can be run both from the DOS command line and from batch files.
RReboot Restart computers remotely. This utility can be used on Windows NT/2000/XP/2003/Vista systems only.
Wait Use Wait utility to make your batch files wait.

Additional job templates

  *** How to add new job template ***
  File replication over dynamic dial-up connection
  Real-time file and directory mirroring between 2 computers
  Bi-weekly schedule
  Monthly schedule type -- starting job on nth business day of every month (counting forward from the start of month)
  Monthly schedule type -- starting job on nth business day of every month (counting backward from the end of month)
  Import data from tab-separated file into database table
  Export data from database table into tab-separated file
  One-way database replication (replication between same or different kind of database systems)
  Two-way database replication (replication between same or different kind of database systems)
  Multi-file search & replace operations
  File contents watch, find changes and email them
  Run program or OS command as another user  -  ** requires v3.2.0 or later
  Run job as another user (job can be of any type, including JAL, SQL, and VBScript)  -  ** requires v3.2.0 or later
  Copy job to remote 24x7 Schedulers  -  ** requires v3.2.0 or later
  Copy entire job folder to remote 24x7 Schedulers  -  ** requires v3.2.0 or later
  Copy entire job database including settings to remote 24x7 Schedulers  -  ** requires v3.2.0 or later
  Multiple file server free space monitor  -  ** requires v3.2.2 or later


General scripts and tips

  Running job between 9:00 AM and 5:00 PM every workday (for 24x7 Scheduler versions 1.0 - 3.1)
  Scheduling job to not to run on particular days (job exception days)
  Converting dates to file names
  Converting comma-separated data file to tab-separated file (24x7 Scheduler versions v1.0 - 1.6.3)
  Scanning program log file for errors (24x7 Scheduler versions v1.0 - 1.6.3)
  Processing files using file mask
  Collecting Web server performance statistics
  Monitoring file server free space
  Establishing Dial-Up connection, avoiding line drops
  Loading data into database
  Starting NT service, executing job, stopping service
  Paging/notifying system administrators (24x7 Scheduler versions v1.0 - 2.4)
  Restoring network connection
  Unattended server reboot
  Using FTP commands
  Redirecting program output to a file
  Automating data input for DOS console programs
  Verifying overnight data feed
  Using Windows messages
  Watching for file changes
  Adding job error messages to the Windows NT event log
  Executing jobs during user "idle" times (24x7 Scheduler versions v1.0 - 1.5.1)
  Watching for files (true file watch)
  Sending keystroke to a DOS application
  Scheduling job to run every 48 hours
  Examples of formatting data
  Monitoring Windows NT/2000 services
  Preventing jobs from the same "class" to run simultaneously (24x7 Scheduler versions v2.0 and later)
  Schedule DTS package
  Schedule 24x7 Scheduler restart


Advanced scripts and tips

  Using 24x7 RA servers for Unix to automate Unix jobs - step-by-step guide with schreenshots (PDF file ~570K)
  Using 24x7 API (application program interface)
  Using email messages to dynamically create new jobs
  Dynamically creating new and modifying existing jobs from a script
  Creating restartable jobs (continue after point-of-failure)
  Creating "retry on fail" jobs (self-rescheduling jobs) (24x7 Scheduler versions v1.0.0 - v1.6.3)
  Using DDE with Lotus Notes to send email
  Using DDE with cc:Mail to send email
  Using SENDMAIL utility with 24x7 Scheduler
  Redirecting standard I/O of a console application using batch file
  Calling a program in AS400
  Calling a program in AS400 (yet another tip)
  Monitoring Oracle database server free space
  Automating SQL-Server DBA functions (update statistics)
  Automating SQL-Server DBA functions (monitor locks)
  Automating SQL-Server DBA functions (monitor and dump filled logs)


Other scripts and tips

  Setting connection to Remote Agent (example)
  Setting Remote Control connection (example)
  Setting Windows NT to automatically logon to the machine and network, bypassing the Winlogon dialog box
  Considerations for running 24x7 Scheduler as a service on Windows NT/2000 servers and workstations
  Configuring Master and Standby schedulers for fail-over mode (example for 24x7 Scheduler for Windows)
  Ensuring High Availability and Fail-over for 24x7 Scheduler Java Edition
  Archiving job execution logs
  Configuring database interfaces and profiles in 24x7 Scheduler Java Edition


If you have some good scripts or tips that you would like to share, please submit them for adding to this archive.