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 &.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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