Hi everyone,
i need some help to schedule a autoload program.
I use mobaxterm to load the data and i want to schedule a task to run the loading script every day at 17,00.
I read something but i need more detailed information about the procedure.
Can everybody help me step by step?
Thanks you so much
@Sm6,
That's easy. Just run this command:
crontab -e
And add:
0 17 * * * /PATH/TO/AUTOLOAD/SCRIPTS/FOLDER/runsas.sh
@alexal thank for answering.
Unfortunately i never used ssh script! It's not so easy for me understanding the script and i don't have much time to better understand the code.
I need to know where to schedule the time to autoload and where to specify the path to the sas script i wrote for loading the table.
here are the script Schedule.sh, runsas.sh and the autoload.sas program.
Can you please add comments where i need to change the information!
Thank you so much!!!
#!/bin/bash
#
# schedule.sh
#
# syslog Schedule AutoLoad.sas
#
RUNSAS_PATH="/sas/config/Lev1/Applications/SASVisualAnalytics/VisualAnalyticsAdministrator/runsas.sh"
TIME_INTERVAL_MINUTES=15
#call to runsas.sh
cat <(fgrep -i -v $RUNSAS_PATH <(crontab -l)) <(echo "*/$TIME_INTERVAL_MINUTES * * * * $RUNSAS_PATH > /dev/null ") | crontab -
cat -> to look through a file, the quickest way to get all the contents on your screen
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
#
# runsas.sh
#
# syslog Run AutoLoad.sas
#
# Source level_env
. /sas/config/Lev1/level_env.sh
SERVER_CONTEXT=SASApp
APPSERVER_ROOT=$LEVEL_ROOT/$SERVER_CONTEXT
AUTOLOAD_ROOT=/sas/config/Lev1/Applications/SASVisualAnalytics/VisualAnalyticsAdministrator
FILENAME="$AUTOLOAD_ROOT/AutoLoad.sas"
LOG_FILE="$AUTOLOAD_ROOT/Logs/AutoLoad_#Y.#m.#d_#H.#M.#s.log"
LST_FILE="$AUTOLOAD_ROOT/Logs/AutoLoad.lst"
PID_FILE=$AUTOLOAD_ROOT/autoload.pid
CFG_FILE="$AUTOLOAD_ROOT/AutoLoad.cfg"
MOD_FILE="$AUTOLOAD_ROOT/AutoLoad_usermods.cfg"
# Set config file path
export SASCFGPATH="$APPSERVER_ROOT/sasv9.cfg, $APPSERVER_ROOT/sasv9_usermods.cfg, $CFG_FILE, $MOD_FILE"
# Function to run the autoload.sas program and save the pid
fnRunSAS()
{
cd $APPSERVER_ROOT
$SAS_COMMAND -sysin $FILENAME -log $LOG_FILE -print $LST_FILE -batch -noterminal -logparm "rollover=session" &
echo $! > $PID_FILE
}
# Ensure process listed in autoload.pid is not running
if [ -f $PID_FILE ]; then
kill -0 $(< $PID_FILE) > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "autoload still running (pid $(< $PID_FILE))"
exit 1
else
fnRunSAS
fi
else
fnRunSAS
fi
exit 0
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
/*
* AutoLoad
*
* Purpose: Synchronizes SAS data sets placed in a single disk location with
* a single LASR Analytic Server library defined in metadata.
*
*/
/* Set the name of the LASR library to which to Auto Load */
%LET AL_META_LASRLIB=Visual Analytics Public LASR;
/* Include and execute main AutoLoad functionality */
%LET INCLUDELOC=/sas/sashome/SASVisualAnalyticsHighPerformanceConfiguration/7.3/Config/Deployment/Code/AutoLoad/include;
/* ------- No edits necessary below this line -------- */
filename inclib "&INCLUDELOC.";
%include inclib ( AutoLoadMain.sas );
%AutoLoadMain;
@Sm6.
With schedule.sh you can add an entry that will start runsas.sh every X minute. By default 15. If you want to start the autoload process everyday at 17:00 you have to add this entry to the crontab:
0 17 * * * /sas/config/Lev1/Applications/SASVisualAnalytics/VisualAnalyticsAdministrator/runsas.sh
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.