How to schedule a job in every 4 hours in Autosys - autosys

I want to schedule a job in autosys in every 4 hours. Like this: 00:40, 04:40, 08:40, 12:40.
Could anyone help with with the JILL code syntax? I tried this It's failing.
start_times: "00:40, 4:40, 8:40, 12:40, 16:40"
days_of_week: "su,mo,tu,we,th,fr,sa"
date_conditions: "1"

Here you go:
insert_job: job_name job_type: BOX
owner: owner#us
date_conditions: 1
days_of_week: su,mo,tu,we,th,fr,sa
start_times: "00:40,04:40,08:40,12:40,16:40"
description: "test box"

Try the following:
insert_job: job_name job_type: c <br>
command: 'ls /abc/def/' <br>
machine: abc#def.com <br>
owner: owner#us <br>
date_conditions: 1 <br>
days_of_week: all <br>
start_times: "00:40,04:40,08:40,12:40,16:40" <br>
description: "test box" <br>
std_out_file: abc/def/success.log <br>
std_err_file: abc/def/error.log <br>

Related

Ansible task with async and become giving Job not found error

When I am trying to run a task asynchronously as another user using become in ansible plabook, I am getting "Job not found error". Can some one suggest me how can I successfully check the async job status.
I am using ansible version 2.7
I read in some articles suggesting use the async_status task with same become user as async task, to read the job status.
I tried that solution but still I am getting the same "job not found error"
- hosts: localhost
tasks:
- shell: startInstance.sh
register: start_task
async: 180
poll: 0
become: yes
become_user: venu
- async_status:
jid: "{{start_task.ansible_job_id}}"
register: start_status
until: start_status.finished
retries: 30
become: yes
become_user: venu
Expected Result:
I should be able to Fire and forget the job
Actual_Result:
{"ansible_job_id": "386361757265.15925428", "changed": false, "finished": 1, "msg": "could not find job", "started": 1}

grep 'post_content' while parsing with cat & pipe into 'post_name'.html

sample entry:
post_content: " some <strong >blablablabla</strong> text in <html>"
post_title: Kontakt
post_password:
post_name: kontakt
question:
i have an yaml-file with entries like above and i like to parse the content of post_content with cat & grep and pipe it in to different file.
$ cat posts.yaml | grep post_content >> different-file.yaml
This works. very well :) but in this way i only excude all post_content from the *posts.yaml
on top of it i like to separate each post_content in to separate filea named like post_name.yaml - i think its possible to do with some sed-foo merge this in one line of shell comand. but atm i have no idea to do so.
Try:
awk '/post_content:/{content=$0} /post_name:/{print content>$2".yaml"; close($2".yaml")}' posts.yaml
Example
Consider this test file:
$ cat posts.yaml
post_content: " some <strong >blablablabla</strong> text in <html>"
post_title: Kontakt
post_password:
post_name: kontakt
post_content: " some other text in <html>"
post_title: Kontakt
post_password:
post_name: contact
We then run:
awk '/post_content:/{content=$0} /post_name:/{print content>$2".yaml"; close($2".yaml")}' posts.yaml
After this command is run, there will, in addition to posts.yaml, be two new files in the current directory:
$ ls
contact.yaml kontakt.yaml posts.yaml
The contents of the new files are:
$ cat kontakt.yaml
post_content: " some <strong >blablablabla</strong> text in <html>"
$ cat contact.yaml
post_content: " some other text in <html>"
How it works
/post_content:/{content=$0}
Every time that we reach a line that contains post_content:, we save the line in variable content.
/post_name:/{print content>$2".yaml"; close($2".yaml")}
Every time that we reach a line that contains post_name:, we print the variable content to a file whose name is given by the second field on the line followed by.yaml`.

Loop in loop robot framework

I have 2 txt file that's have data like that :
Account.txt
12345
12346
12347
Card.txt
1111
2222
3333
i want to loop both txt file in sametime and input into Text box Card and textbox account .
<form action="">
Account:<br>
<input type="text" name="acc">
<br>
Card:<br>
<input type="text" name="card">
</form>
<button type="submit" form="form1" value="Submit">Bind</button>
I already try to loop but i can only loop one txt file . i can't loop 2 txt file in same time to input textbox .
Can anyone give me any suggestion ?
You can use a For-in-zip loop
For example, assuming you read both files and split the data so that you have two arrays #{account} and `#{card}, you can iterate over both lists at the same time like this:
:FOR ${account} ${card} IN ZIP ${account} ${card}
\ log account: ${account} card: ${card}
Here's a complete example:
*** Test Cases ***
Example
#{account}= Create List 12345 12346 12347
#{card}= Create List 1111 2222 3333
:FOR ${account} ${card} IN ZIP ${account} ${card}
\ log account: ${account} card: ${card}
Just run an independent FOR-loop und use a variable as index for your arrays:
#{account} Create List 12345 12346 12347
#{card} Create List 1111 2222 3333
:FOR ${iter} IN RANGE 3
Log Account: #{account}[${iter}]
Log Card: #{card}[${iter}]
Output:
INFO : #{account} = [ 12345 | 12346 | 12347 ]
INFO : #{card} = [ 1111 | 2222 | 3333 ]
INFO : Account: 12345
INFO : Card: 1111
INFO : Account: 12346
INFO : Card: 2222
INFO : Account: 12347
INFO : Card: 3333

Escape new line in jil file

How could I escape new line in autosys jil file?
delete_job: <job name>
insert_job: <job name> job_type: c
command: <sh file>
machine: <host>
owner: <owner>
permission: gx,mx
condition: s(A, 06.00)
& s(B, 06.00)
std_out_file: <job name>.out
std_err_file: <job name>.err
alarm_if_fail: 0
Previous gives me error:
CAUAJM_E_50254 Unexpected line for <job name>: &

Saltstack: ignoring result of cmd.run

I am trying to invoke a command on provisioning via Saltstack. If command fails then I get state failing and I don't want that (retcode of command doesn't matter).
Currently I have the following workaround:
Run something:
cmd.run:
- name: command_which_can_fail || true
is there any way to make such state ignore retcode using salt features? or maybe I can exclude this state from logs?
Use check_cmd :
fails:
cmd.run:
- name: /bin/false
succeeds:
cmd.run:
- name: /bin/false
- check_cmd:
- /bin/true
Output:
local:
----------
ID: fails
Function: cmd.run
Name: /bin/false
Result: False
Comment: Command "/bin/false" run
Started: 16:04:40.189840
Duration: 7.347 ms
Changes:
----------
pid:
4021
retcode:
1
stderr:
stdout:
----------
ID: succeeds
Function: cmd.run
Name: /bin/false
Result: True
Comment: check_cmd determined the state succeeded
Started: 16:04:40.197672
Duration: 13.293 ms
Changes:
----------
pid:
4022
retcode:
1
stderr:
stdout:
Summary
------------
Succeeded: 1 (changed=2)
Failed: 1
------------
Total states run: 2
If you don't care what the result of the command is, you can use:
Run something:
cmd.run:
- name: command_which_can_fail; exit 0
This was tested in Salt 2017.7.0 but would probably work in earlier versions.

Resources