Sustitute text in RUN_PROGRAM

16 views
Skip to first unread message

Alonso Gómez

unread,
May 8, 2020, 5:19:02 AM5/8/20
to schedulix
Hello,

I need to change a substring of run program field in a lot of Jobs.... Need search jobs with substring like "p__web%01,p__web%02" and change this string by "p__web%11,p__web%12". How can I do that with sdmsh o GUI? I am using 2.9 version.

Thanks you.

Ronald Jeninga

unread,
May 8, 2020, 6:24:20 AM5/8/20
to schedulix
Hi Alonso,

I usually perform such tasks using a SELECT statement.
A starting point is something like

select 'alter job definition ' as col1, id, 'with run program = ''' as col3, some_expression_that_modifies_the_run_program_according_to_your_requirements() as col4, ''';' as col5
from sci_c_scheduling_entity
where run_program like '%p__web%01,p__web%02%'
with id job quoted;


This statement (with a few corrections of course) executed in the shell will output a number of rows.
If you select them and paste them into the shell again, you can do the bulk update.
(and a good practice is to execute a single line first in order to check if this indeed does what you'd like it to do.

Note the column aliases (as col1, as col3, ...). They are not always required, but it is good practice.
Some database systems are very creative in generating column headers. So creative that it sometimes confuses the GUI or even the server.
In that case the statement mysteriously refuses to work.

Furthermore you can use

BEGIN MULTICOMMAND

/* bunch of statements */

END MULTICOMMAND ROLLBACK;


to check if your list of statements would execute without errors.
If the system reports that the statement has been rolled back on the user's request, it would work.
Any other error message indicates a problem.

HTH

Best regards,

Ronald 

Alonso Gómez

unread,
May 12, 2020, 7:48:13 AM5/12/20
to schedulix
Hi Ronal,

Thanks for the previus advice...

I have a new question... How can I change de name with sdmsh for a scope and a jobserver?, in other words, I want change the name from GLOBAL.SCOPE01.JOBSERVER01 to GLOBAL.SCOPE11.JOBSERVER11 with sdmsh.

Thanks you.

Alonso Gómez

unread,
May 12, 2020, 7:54:36 AM5/12/20
to schedulix
Sorry,

I need to change, just like the previus, the name of a resource.... RESOURCE.JOBSERVERS.JOBERSER01 to RESOURCE.JOBSERVERS.JOBERSER11

Thanks again.

Ronald Jeninga

unread,
May 12, 2020, 8:43:51 AM5/12/20
to schedulix
Hi Alonso,

In case of the rename of a scope you'll need two commands, e.g.

begin multicommand
rename scope  GLOBAL
.SCOPE01 to SCOPE11;
rename scope GLOBAL
.SCOPE11.JOBSERVER01 to JOBSERVER11;
end multicommand;



It's just like renaming files and directories. And in fact the alternative is to use the MOVE command instead.
But since you don't actually want to move the objects within the tree, I think that the RENAME command is the better choice for documentation reasons.

In case of the resource you want to rename the NAMED RESOURCE, not the instance of it.
Hence

rename named resource RESOURCE.JOBSERVERS.JOBERSER01 to JOBERSER11;


(Are you sure that the resource is called like you spelled in in your question?)
After the rename of the named resource you'll find that all instances of it carry the new name too.

Anyway, we've put quite a lot of effort into documenting the SDMS language. It is a document I use myself quite a lot.
It is contained in the schedulix-doc rpm, stored in the source tree in GitHub and you can download it from our web site.
Studying that manual will be the first step on the path to "power user" and it will enable you to automate recurring actions or to easily perform bulk actions.

Best regards,

Ronald
Reply all
Reply to author
Forward
0 new messages