Monday, 2 September 2024

AutoSys Permission Options and Simple File Operations

 



AutoSys Permission Options and Simple File Operations

AutoSys is a popular job scheduling tool used to automate complex business processes. When dealing with file operations in AutoSys, understanding permission options and how to execute file operations efficiently is crucial.

AutoSys Permission Options

AutoSys provides several permission options to manage access control. These options allow administrators to define who can create, edit, delete, or execute jobs. Some of the key permission options include:

  1. Job-Level Permissions:

    • owner: Specifies the user who owns the job. Only the owner or a superuser can modify or delete the job.
    • permission: Defines the permissions granted to users or groups for a specific job. Permissions may include r (read), w (write), x (execute), and d (delete).
  2. Global Permissions:

    • admins: A list of users who have administrative privileges, allowing them to manage all jobs within the system.
    • operators: Users who can execute jobs but may not have the permissions to create or edit jobs.
  3. File and Directory Permissions:

    • AutoSys jobs often involve file manipulation, so Unix/Linux file permissions (like chmod, chown, etc.) play a role. Ensure that the user running the job has appropriate permissions on the files and directories involved.

Simple File Operation: Appending a String to a File

You want to append a string to a file and output the result to a new file using a single command in AutoSys. Given that AutoSys may not allow the use of multiple commands separated by && or ; within a single command, you can achieve this using a simple shell script or a single command.

Example Command:

Let's assume you have file1 and want to append the string "oranges" to create file2 without altering file1.

Command:

sh:

cat file1 <(echo "oranges") > file2
Explanation:
  • cat file1: Outputs the content of file1.
  • <(echo "oranges"): Generates a file-like string "oranges" and appends it to the output.
  • > file2: Redirects the combined output to file2.

AutoSys Job Example:

jil:

insert_job: append_string_job job_type: c command: cat /path/to/file1 <(echo "oranges") > /path/to/file2 owner: your_username permission: wx machine: your_machine_name

This job reads the content of file1, appends the string "oranges", and writes the result to file2, all while keeping the original file1 unchanged.

Conclusion

AutoSys provides flexible permission options to control access to jobs, ensuring secure operations. Additionally, by leveraging simple shell commands, you can perform file operations like appending strings in a straightforward manner, even within the constraints of an AutoSys job environment.

AutoSys Scheduler: How to Update Jobs Using JIL

 



AutoSys Scheduler: How to Update Jobs Using JIL

Introduction to AutoSys and JIL

AutoSys is an automated job control system for scheduling, monitoring, and reporting on job executions across various platforms. It is widely used in enterprise environments to manage complex job workflows, ensuring that jobs run at the right time, in the right sequence, and under the right conditions.

Job Information Language (JIL) is a scripting language used in AutoSys to define job attributes. It allows users to create, modify, and manage jobs in AutoSys. A JIL file contains a set of job definitions that AutoSys can interpret and execute. Understanding how to update jobs using JIL is crucial for maintaining and optimizing job workflows.

Key Concepts in JIL

Before diving into updating jobs, it's essential to understand some of the key JIL components:

  • Job Definition: Describes the job's attributes such as its name, type, command to execute, schedule, etc.
  • Job Types: AutoSys supports various job types like CMD (command job), FW (file watcher job), and BOX (a container for grouping jobs).
  • Attributes: Properties that define how and when the job should execute, such as command, start_times, condition, run_calendar, etc.

Steps to Update a Job Using JIL

  1. Access the JIL Editor:

    • Open the command-line interface (CLI) where AutoSys is installed.
    • Type jil and press Enter to enter the JIL editor.
  2. List Existing Job Attributes (Optional):

    • Before making updates, you may want to view the current attributes of the job.
    • Use the autorep command to display the job’s existing configuration:
      bash:

      autorep -J <job_name>
  3. Create or Update the JIL File:

    • To update an existing job, you can either edit the job directly in the JIL editor or modify a pre-existing JIL file.
    • Example JIL syntax for updating a job:
      jil:

      update_job: <job_name> command: <new_command> start_times: <new_start_times> run_calendar: <new_calendar> condition: <new_condition>
    • Replace <job_name> with the actual job name, and update other attributes as necessary.
  4. Submit the Updated JIL:

    • After making changes, you can submit the JIL to AutoSys by either pasting the updated JIL code directly into the JIL editor or using a JIL file.
    • If using a file, save the updates in a .jil file and execute:
      bash:

      jil < my_updated_job.jil
  5. Verify the Update:

    • Once the JIL is submitted, verify that the job has been updated correctly using:
      bash:

      autorep -J <job_name>
    • Check that the job attributes reflect the updates made.
  6. Testing the Updated Job (Optional):

    • It’s good practice to test the job after updating it to ensure that it behaves as expected.
    • You can start the job manually using the sendevent command:
      bash:

      sendevent -E FORCE_STARTJOB -J <job_name>
    • Monitor the job’s execution using autorep to ensure it runs smoothly.

Common Scenarios for Updating Jobs

Here are some common scenarios where updating JIL might be necessary:

  • Changing the Command: If the script or executable that the job runs has been updated or moved, you’ll need to update the command attribute.
  • Modifying the Schedule: Changes in business requirements may necessitate updates to the job’s schedule, such as altering the start_times, run_calendar, or days_of_week.
  • Adjusting Dependencies: As workflows evolve, the job’s dependencies (condition) may need to be updated to reflect new or removed dependencies.
  • Updating Notifications: Adjusting the job’s notification settings to inform different users or systems of job status changes.

Best Practices for Updating JIL

  • Version Control: Keep a version history of JIL files to track changes and roll back if necessary.
  • Testing: Always test jobs after updating them to ensure they function as expected.
  • Documentation: Document any changes made to job definitions to maintain clarity in the job management process.

Conclusion

Updating jobs using JIL in AutoSys is a critical task that ensures jobs run according to updated requirements and business needs. By following the steps outlined above and adhering to best practices, you can effectively manage and optimize job workflows within your AutoSys environment.