BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

Hello,

 

I have many sas programs that I need to execute on a unix server by sending the following command directly to the terminal windows (winscp)

 

nohup sas -sysparm '20230315#' /dwh_actuariat/.../HYFI_INTExpSF.sas &
nohup sas -sysparm '20230415#' /dwh_actuariat/.../HYFI_INTExpSF.sas &
nohup sas -sysparm '20230515#' /dwh_actuariat/.../HYFI_INTExpSF.sas &
 
I could also put those instructions into a ksh file and just execute the ksh file.
But I wonder how to make sure that the first job is completed before starting the second one. Same thing for the last job, how to make sure that the second job is completed before starting the last one.
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

If you want to make sure the jobs run in succession, do not run them in the background (that's what the & does).

To run the jobs in succession in the background, put them into a shell script (without the nohup and &), and run the script with nohup and &.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Remove the &.

 

If the list is large it might be easier with two files.  One with the list of programs to run:

sas -sysparm '20230315#' -log 20230315.log /dwh_actuariat/.../HYFI_INTExpSF.sas
sas -sysparm '20230415#' -log 20230415.log /dwh_actuariat/.../HYFI_INTExpSF.sas 
sas -sysparm '20230515#' -log 20230515.log /dwh_actuariat/.../HYFI_INTExpSF.sas 

Then a second one that calls that file which could then use nohup to allow it to complete even if the shell that launched it is closed.

Kurt_Bremser
Super User

If you want to make sure the jobs run in succession, do not run them in the background (that's what the & does).

To run the jobs in succession in the background, put them into a shell script (without the nohup and &), and run the script with nohup and &.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 253 views
  • 1 like
  • 3 in conversation