How to move autosys job out of the box? - autosys

I have a job which runs in the box.
insert_job: template job_type: c
box_name: box1
.
.
.
I want to move this job out of the box1 What change should I make in the JIL definition?

To update an existing job use update_job.
update_job: template job_type: c
box_name:
Keep the box_name attribute as blank and run the JIL.
This removes the job from the defined box.

Related

Tmux refresh client call from fish shell alias

I want tmux pane title to refresh immediately after I start htop, so I added alias in my config.fish:
alias h "htop;tmux refresh-client -S"
But it does nothing. I also tried with delay:
alias h "htop;sleep 0.1;tmux refresh-client -S"
That also did nothing - tmux still refreshes only after default interval, which is too long for me, and you can only decrease it to 1 second and not less.
What did I do wrong and is it even possible what I want to do?
Maybe this is a bit easier to see when we remove the alias from the equation:
echo banana; sleep 5s; echo sausage
will echo "banana", wait for 5 seconds and only then print "sausage", so
htop; tmux refresh-client -S
will run htop, wait until it is finished and then run tmux refresh-client -S, at which point fish will be the foreground process again.
What would have to be done instead is to get the shell to integrate with tmux. Now, apparently tmux has an escape sequence for Names and titles, so
printf '\ekhtop\e\\' # \e is \033 - the escape character
changes the window title to "htop".
Fish has events that functions can be bound to, so something like
function tmux_name --on-event fish_preexec
printf '\ek%s\e\\' "$argv" # the argument for preexec is the commandline about to be executed
end
will set the tmux window name always to the command line. This won't reset it when the command has finished, so we need a second function
function tmux_reset_name --on-event fish_postexec
# $argv for postexec is also the commandline
# so we can't use it. Just hardcode "fish".
printf '\ek%s\e\\' fish
end
Not that this is perfect or anything - it'll still set the title even for very short-running commands, it'll use the full commandline even for long commands (maybe using just $argv[1] would be better).
Note that these functions will have to be defined in config.fish or a file explicitly sourced by it (or ~/.config/fish/conf.d/), because function files are autoloaded, so fish won't know about the event.

ksh script variables run differently in nohup

I have a script called cmdtst_multi.ksh and when I run it like this:
. ./cmdtst_multi.ksh
I have a varible that gets populated like this;
treeLvls=$(td_query {})
echo "num of tree lvls:" $treeLvls
##gives back num of tree lvls: 4
treeLvlsSQL=$(for i in {1..$treeLvls}
do
echo ",NULL as LVL$i"
done)
echo "tree sql:" $treeLvlsSQl
#gives back tree sql: ,NULL as LVL1 ,NULL as LVL2 ,NULL as LVL3 ,NULL as LVL4
it runs fine
but when I run it like this:
nohup cmdtst_multi.ksh > prcsstst.log &
the treeLvlsSQl comes out like this in the log file, which is not correct:
tree sql: ,NULL as LVL{1.. ,NULL as LVL4}
why do the variables seem to run differently?
My guess is this difference has something to do with the seemingly innocuous sourcing operator(.) or the current directory operator(./) at the beginning of your script.
nohup - is no hangup to make the process not to hangup when the
user log outs
> prcsstst.log & - redirects to log file and backgrounds the
process
which rules out them as contenders for the difference in output.
Please try the nohup with sourcing operator like below:
nohup ksh93 -c ". ./cmdtst_multi.ksh" > prcsstst.log
. and ./ are important . implies sourcing the current shell which prevents spawning a separate child shell with new set of environment variables and ./ implies the script in . (current directory) is executed instead of some other script with the same name defined in $PATH.
Edit: As Jonathan Leffler points out in his comment, this could also be because KSH not being used by nohup (KSH is not the default shell perhaps?) which might explain why the KSH's FOR syntax worked initially when sourced(.) from current shell(KSH?) but not the second time around(some other type of shell).

How to reset number of retrys on Autosys job

I have a list of jobs that have number of retrys set on them (in jil definition). When I get the job status, I see the number of retrys (in this case 12). I am trying to find a way to reset that:
->autorep -J XXXXX%
Job Name Last Start Last End ST Run/Ntry Pri/Xit
XXXXXX 03/19/2014 14:27:38 03/19/2014 14:56:07 SU 146461/12 0
number of retries could be set on a job level:
look for n_retrys: in output of command autorep -J XXXXX% -q
or it could be on server level:
grep -i MaxRestartTrys config.$AUTOSERV
MaxRestartTrys=10
the third option is that the job was triggered manualy multiple times.

Set the terminal tab title as prompt name in unix

Lets say, the prompt is as below
run_scripts >
How to set that terminal tab title same as prompt
i.e Terminal tab tile also should be
run_scripts>
So that terminal title should dynamically update when the prompt changes.
Many terminals emulators are able to understand the special escaping : "\033]0;foo\007".
I know its a old post but i saw it today :
Here is the answer:
title `pwd`
if title command does not works in your shell then:
write a shell script with follwing contents (filename = title)
#!/usr/bin/tcsh -f
echo "^[]2;$1^G^[]1;$1^G"
then:
chmod +x title (give this script executable permission)
type:
title `pwd` <enter>
This single line command will change the title of the tab.
Simply run the command from terminal tab which title need to change-
PS1=$PS1"\[\e]0;My_Tab_Name\a\]"
Some Info:
The PS1 is a primary prompt variable which holds the characters displayed at the terminal prompt. You can set it whatever you want. However the above command will make it only work for current terminal session. Once you close the terminal and opena new one, it'll be the default one.
To make it permenant edit the PS1 variable in ~/.bashrc or ~/.zshrc file.
Benefits-
It help us to easily navigate over the tabs.

Setting environment variable in shell script does not make it visible to the shell

I want to use a shell script that I can call to set some environment variables. However, after the execution of the script, I don't see the environment variable using "printenv" in bash.
Here is my script:
#!/bin/bash
echo "Hello!"
export MYVAR=boubou
echo "After setting MYVAR!"
When I do "./test.sh", I see:
Hello!
After setting MYVAR!
When I do "printenv MYVAR", I see nothing.
Can you tell me what I'm doing wrong?
This is how environment variables work. Every process has a copy of the environment. Any changes that the process makes to its copy propagate to the process's children. They do not, however, propagate to the process's parent.
One way to get around this is by using the source command:
source ./test.sh
or
. ./test.sh
(the two forms are synonymous).
When you do this, instead of running the script in a sub-shell, bash will execute each command in the script as if it were typed at the prompt.
Another alternative would be to have the script print the variables you want to set, with echo export VAR=value and do eval "$(./test.sh)" in your main shell. This is the approach used by various programs [e.g. resize, dircolors] that provide environment variables to set.
This only works if the script has no other output (or if any other output appears on stderr, with >&2)

Resources