JobSubmitter Server Documentation

Overview

The JobSubmitter program is a C# console application designed to submit and manage jobs on a remote server. It interacts with a MySQL database to store job records and uses TCP/IP for communication with the server. The program can also fetch information about the host.

Dependencies

  • MySql.

Configuration

The program reads database connection details from a configuration file named jd.config. The configuration file should contain the following parameters:

  • Server
  • Port
  • Database
  • User ID
  • Password

Command-Line Arguments

The program accepts the following command-line arguments:

  • -host : Specifies the IP address of the host.
  • -i : Specifies the path to the script file to be executed.
  • -run : Specifies the script content to be executed directly.
  • -info: Fetches information about the host.

Example Usage

dotnet run --project JobSubmitter.csproj -- -host xxx.xxx.xx.xx -i /path/to/script.sh
dotnet run --project JobSubmitter.csproj -- -host xxx.xxx.xx.xx -run "echo Hello World"
dotnet run --project JobSubmitter.csproj -- -host xxx.xxx.xx.xx -info

Error Handling

The program includes error handling for database operations, file operations, and network communication. Errors are logged using the Logger class.

Logging

The Logger class logs messages to both the console and a log file located at C:\\temp\\job_submitter_log.txt.

Security Considerations

  • Ensure the jd.config file is secured and not exposed to unauthorized users.
  • Validate and sanitize all inputs to prevent SQL injection and other security vulnerabilities.

Future Improvements

  • Implement more robust error handling and retry mechanisms for network operations.
  • Add support for additional script execution environments.
  • Enhance logging with more detailed information and different log levels.