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

Hi folks,

 

We have SAS 9.4M6 installed on Linux (RedHat). We have a simple script to run SAS programs on batch but we have the following error.

 

nohup: failed to run command ‘/sas/config/Lev1/SASApp/BatchServer/sasbatch.sh’: No such file or directory

 

We used the same script on other server (SAS 9.4M5 HP-UX) and works fine. We double check and the path of sasbatch.sh file is correct. 

 

We don't change anything on sasbatch.sh, is the original file.

 

Any idea?

 

Our scripts is:

 

#! /bin/sh

umask 007

PATH=.:opt/bin:/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/GNU/bin/make:/usr/ucb:/sas/software/SASFoundation/9.4/bin:/home/sas_all/bin:/home/sas/bin
export PATH

sasprogpath=`dirname "$1"`

sasprog=`basename "$1"`

cd $sasprogpath

nohup /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh -log /unicomer/tmp/runsas/$sasprog.#Y_#m_#d.log -batch -noterminal -logparm "rollover=session" -xcmd -sysin $1 &
1 ACCEPTED SOLUTION

Accepted Solutions
MariaD
Barite | Level 11

@alexal ,

 

Finally, we found it! The original "sasbatch_usermod.sh" (the ones created during SAS installation), contains "set -A USERMODS_OPTIONS" and "-A" is not recognized on Linux. The solution was comment that line. 

 

[sas@XXXXX BatchServer]$ cat sasbatch_usermods.sh
#!/bin/ksh -p
#
# sasbatch_usermods.sh
#
# This script extends sasbatch.sh.  Add local environment variables
# to this file so they will be preserved.
#

#set -A USERMODS_OPTIONS   # initialize empty list
# build up list by un-commenting (and adding) the lines you need (one line per token)
# then replace the <argument> with the values you want for each token on the command line
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"

Thanks,

View solution in original post

17 REPLIES 17
alexal
SAS Employee

@MariaD ,

 

Please run your script with "sh -x" in the front and show me the output.

sh -x /path/to/your/script.sh
MariaD
Barite | Level 11

Hi @alexal ,

 

Follows the results of the command:

 

+ umask 007
+ PATH=.:opt/bin:/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/GNU/bin/make:/usr/ucb:/sa                  s/software/SASFoundation/9.4/bin:/home/sas_all/bin:/home/sas/bin
+ export PATH
++ dirname /tmp/runsas/test.sas
+ sasprogpath=/tmp/runsas
++ basename /tmp/runsas/test.sas
+ sasprog=test.sas
+ cd /tmp/runsas
+ nohup /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh -log /tmp/runsas/test.sas.#Y_#m_#d.log -batch -noterminal -logparm rollover=session -xcmd -sysin /tmp/runsas/test.sas
[sas@XXXXXXXX runsas]$ nohup: appending output to ‘nohup.out’
nohup: failed to run command ‘/sas/config/Lev1/SASApp/BatchServer/sasbatch.sh’: No such file or directory
Kurt_Bremser
Super User
nohup: failed to run command ‘/sas/config/Lev1/SASApp/BatchServer/sasbatch.sh’: No such file or directory

The path to sasbatch.sh is incorrect. Check with your SAS administrator where the SAS configuration is located.

MariaD
Barite | Level 11

Hi @Kurt_Bremser ,

 

The path is correct. If you see in the attached file, sasbatch.sh is located on /sas/config/Lev1/SASApp/BatchServer directory.

 

Regards,

alexal
SAS Employee

@MariaD ,

 

Please show me the output from these commands:

 

id
ls -ld /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
sh -x /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
MariaD
Barite | Level 11

Hi @alexal ,

 

Follows the results:

 

[sas@XXXXX BatchServer]$ id
uid=1001(sas) gid=1001(sas) groups=1001(sas) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[sas@XXXXX BatchServer]$ ls -ld /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
-rwxr-xr-x. 1 sas sas 1074 May 26 13:13 /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
[sas@XXXXX BatchServer]$ sh -x /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
+ unset METAUSER
+ unset METAPASS
+ parentpath=/sas/config/Lev1/SASApp
+ . /sas/config/Lev1/SASApp/appservercontext_env.sh
+++ dirname /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
++ '[' -f /sas/config/Lev1/SASApp/BatchServer/../level_env.sh ']'
+++ dirname /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh
++ . /sas/config/Lev1/SASApp/BatchServer/../../level_env.sh
+++ LEVEL_ROOT=/sas/config/Lev1
+++ UTILITIES=/sas/software/SASDeploymentManager/9.4/products/cfgwizard__94514__prt__xx__sp0__1/Utilities
+++ DEPLOYWIZ=/sas/software/SASDeploymentManager/9.4/products/deploywiz__94514__prt__xx__sp0__1/deploywiz
+++ SAS_HOME=/sas/software
+++ JAVA_JRE_COMMAND=/sas/software/SASPrivateJavaRuntimeEnvironment/9.4/jre/bin/java
+++ SASVJR_HOME=/sas/software/SASVersionedJarRepository
+++ SASVJR_REPOSITORYPATH=/sas/software/SASVersionedJarRepository/eclipse
+++ SASWebInfrastructurePlatform_HOME=/sas/software/SASWebInfrastructurePlatform/9.4
+++ SASROOT=/sas/software/SASFoundation/9.4
+++ SAS_COMMAND=/sas/software/SASFoundation/9.4/sas
+++ . /sas/config/Lev1/level_env_usermods.sh
++++ CONTEXT_USERMODS_OPTIONS=
+++ '[' -f /sas/config/Lev1/hadoop_env.sh ']'
++++ hostname
++++ awk -F. '{ printf $1 }'
+++ SHOSTNAME=ip-172-30-4-235
+++ SERVER_PID_FILE_NAME=server.ip-172-30-4-235.pid
+++ export SERVER_PID_FILE_NAME
++ umask 002
++ APPSERVER_ROOT=/sas/config/Lev1/SASApp
++ . /sas/config/Lev1/SASApp/appservercontext_env_usermods.sh
+++ CONTEXT_USERMODS_OPTIONS=
++ cd /sas/config/Lev1/SASApp
+ CONFIGDIR=/sas/config/Lev1/SASApp/BatchServer
+ . /sas/config/Lev1/SASApp/BatchServer/sasbatch_usermods.sh
++ set -A USERMODS_OPTIONS
/sas/config/Lev1/SASApp/BatchServer/sasbatch_usermods.sh: line 9: set: -A: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

Regards, 

 

alexal
SAS Employee

@MariaD ,

 

That is interesting. Show me the output from these commands:

file /path/to/your/script.sh
cat -e  /path/to/your/script.sh
MariaD
Barite | Level 11

@alexal ,

 

Follows the results...

 

[sas@XXXXX runsas]$ file /tmp/runsas/runsas94.sh
/tmp/runsas/runsas94.sh: POSIX shell script, ASCII text executable
[sas@XXXXX runsas]$ cat -e  /tmp/runsas/runsas94.sh
#! /bin/sh$
$
umask 007$
$
PATH=.:opt/bin:/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/GNU/bin/make:/usr/ucb:/sas/software/SASFoundation/9.4/bin:/home/sas_all/bin:/home/sas/bin$
export PATH$
$
sasprogpath=`dirname "$1"`$
$
sasprog=`basename "$1"`$
$
cd $sasprogpath$
$
nohup /sas/config/Lev1/SASApp/BatchServer/sasbatch.sh -log /tmp/runsas/$sasprog.#Y_#m_#d.log -batch -noterminal -logparm "rollover=session" -xcmd -sysin $1 &$
alexal
SAS Employee

@MariaD ,


Line endings are correct there, have you speak with your Linux administrator about the problem?

MariaD
Barite | Level 11

@alexal ,

 

There are reviewing the issue too. We have 2 Linux server and both presents the same issue.

 

Regards, 

alexal
SAS Employee

@MariaD ,

 

I would like to know what they will find.

MariaD
Barite | Level 11

@alexal ,

 

Finally, we found it! The original "sasbatch_usermod.sh" (the ones created during SAS installation), contains "set -A USERMODS_OPTIONS" and "-A" is not recognized on Linux. The solution was comment that line. 

 

[sas@XXXXX BatchServer]$ cat sasbatch_usermods.sh
#!/bin/ksh -p
#
# sasbatch_usermods.sh
#
# This script extends sasbatch.sh.  Add local environment variables
# to this file so they will be preserved.
#

#set -A USERMODS_OPTIONS   # initialize empty list
# build up list by un-commenting (and adding) the lines you need (one line per token)
# then replace the <argument> with the values you want for each token on the command line
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"
#USERMODS_OPTIONS[${#USERMODS_OPTIONS[*]}]="<argument>"

Thanks,

alexal
SAS Employee

@MariaD ,


Weird, -A option should be supported. What kind of shell are you using?

MariaD
Barite | Level 11

@alexal ,

 

The shell version is:

 

GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Regards,

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 17 replies
  • 3660 views
  • 0 likes
  • 4 in conversation