06-16-2017 05:50 AM
I need to run SAS code remotely on a Linux server.
I have a code that runs a long time, and I need to execute this code on the remote machine (Linux), without using the remote desktop connection, so I can turn off my local computer and let the code process remotely.
Could you please suggest if there is a way how this can be done, if possible?
Thanks a lot in advance.
With best regards,
06-16-2017 07:23 AM
With a server-based SAS, you usually have the configuration tree somewhere (BI Server). Something like /sasconf/Lev1/.....
Within that, you find the subtree for the SASApp application server; within that, there's a Batchserver directory that contains the sasbatch.sh script.
This shell script can be used to run batch jobs in the context of the SASApp server.
Convert your SAS code to a .sas file; save it in an appropriate place (eg subdirectory sasprog in your home directory)
Do a test run (maybe with a smaller program that finishes quickly):
/sasconf/Lev1/SASApp/BatchServer/sasbatch.sh $HOME/sasprog/myprog.sas -log $HOME/sasprog/myprog.log
Review the log file. If everything is OK, you can apply this to run in the background:
nohup /sasconf/Lev1/SASApp/BatchServer/sasbatch.sh $HOME/sasprog/myprog.sas -log $HOME/sasprog/myprog.log &
The & at the end redirects the job into the background; running it with nohup means that a disconnection of the telnet/ssh connection will not terminate the job. Any stdout output will be directed to the file nohup.out in the directory from where you called that commandline.
06-16-2017 07:39 AM
Note that it is necessary to supply absolute path names for programs and logs (starting with a forward slash). $HOME provides this (resolves usually to /home/username)
06-16-2017 06:19 AM
If that remote Linux server is your SAS server, then look at background processing (with &) and the nohup command. You have to convert your SAS code to a batch job first (a .sas file that contains all your code and will run from the command line; additional use of configuration will be necessary, depending on your SAS environment)
If SAS is not on the remote server, no luck.