Is there any function/code to rename a AutoSys job through Unix script? - unix

I have 100's of AutoSys job with a prefix.
I have to rename it all with a different prefix.
ex :
123_JobA , 123_JobB
The above two job needs to renamed as 987_JobA, 987_JobB
Is there any way to automate them using Unix script?

Related

R: Learning How to Use Task Scheduler

I am working with the R programming language.
I am trying to learn how to schedule tasks using the Task Scheduler. I found this post Scheduling R Script and I am trying to follow the instructions from the answer provided by "user:: petermeissner":
Step 1:
I opened a notepad document and wrote a small R program that I want the task scheduler to run. In this program, I want to generate 100 random numbers, save these random numbers as an RDS file - and then repeat/overwrite many times:
# r program to run
a = rnorm(100,100,100)
saveRDS(a, "a.RDS")
Then, I saved this file as "myscript.exe"
Step 2:
I went to the "start menu" and typed in "Task Scheduler". I then clicked "Action" and "Create Task". Here, I created a new task uploaded the ".exe" file:
Step 3: Now, I added the details about this task - for example, I want this task to run every 5 minutes. I went to the "Triggers" tab and entered the following information:
My Problem: I waited for 1 hour and noticed that my task did not run even once. Furthermore, when I look at "All Running Tasks" - I noticed that the task I created did not even run!
Can someone please tell me what I am doing wrong and what I can do to fix this?
Thanks!
In a text editor create a batch file: "MyRscript.bat"
The batch file will contain one line:
C:\Program Files\R\R-4.2.2\bin\Rscript.exe C:\rscripts\myscript.R
Ensure that the path is correct to the Rscript.exe file and your script.
Now in task scheduler, schedule running "MyRscript.bat" at the desired time and frequency.
The advantage of creating the bat file is one can now edit this file after upgrading R or changing the script file without the hassle of working in the task scheduler.
Also it is good practice to define your working directory inside the script.
See this question for more information: Scheduling R Script

Search autosys jobs having .ksh scripts

I am trying to list all the Autosys jobs with .ksh scripts in the command attribute and the jobs should not been run for the last 3 months
Any help is much appreciated !!

Automating- Appending two text files to create 1 Excel file daily

I have two files that come in daily to a shared drive. When they are posted, they come in with the current date as part of the file name. example ( dataset1_12517.txt and dataset2_12517.txt) the next day it posts it will be (dataset1_12617.txt and so on). They are pipe delimited files if that matters.
I am trying to automate a daily merge of these two files to a single excel file that will be overwritten with each merge (file name remains the same) so my tableau dashboard can read the output without having to make a new connection daily. The tricky part is the file names will change daily, but they follow a specific naming convention.
I have access to R Studio. I have not started writing code yet so looking for a place to start or a better solution.
On a Window machine, use the copy or xcopy command lines. There are several variations on how to do it. The jist of it though is that if you supply the right switches, the source file will append to the destination file.
I like using xcopy for this. Supply the destination file name and then a list of source files.
This becomes a batch file and you can run it as a scheduled task or on demand.
This is roughly what it would look it. You may need to check the online docs to choose the right parameter switches.
xcopy C:\SRC\souce_2010235.txt newfile.txt /s
As you play with it, you may even try using a wildcard approach.
xcopy C:\SRC\*.txt newfile.txt /s
See Getting XCOPY to concatenate (append) for more details.

Is there any best way to write some scripts automated in putty?

I have some daily performed unix scripts like (cd,ls, etc...) to run on a remote server from putty.Basically I need to automate my daily tasks.
Can anyone suggest me which is the best way to write the scripts.
You can use Plink it is in the putty collection (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
For more details see this thread putty from a batch file and a script?

Autosys JIL insert or update if exists

I'm trying to write an autosys JIL which creates the job if it doesn't exist but updates it otherwise. I would've sworn there was a command for that, like 'update_or_create' or something but I can't find it anywhere.
there are three distinct commands: insert, update and delete _job. no "insert-or-update_job"
You would best do this writing a Python script with something like SQLAlchemy/SQLACodeGen - then interrogate the AutoSys database to use the required verb prefix.

Resources