dfn48
asked on
Commands to start and stop a job using Shell Script
My shell program is supposed to do the following:
1. switch user: su - sasadm.
2. decode: DB_PASSWORD
3. run a command line process that start and stop a job
4. print out sas processes that are run to a log (based on the sas.server stop command)
5. give the user the option to start or stop jobs:
6. print out sas that have stop to a log (based on the sas.server stop command)
When I start and stop the job from the command line, I do the following:
$ ./sas.server start ---- it prints out to the terminal sas processes that are started
$ ./sas.server stop ---- it prints out to the terminal sas processes that have stopped
Here is my code: It is not working:
file name that stores password:db_auth.cfg
DB_PASSWORD=Z29vZ2xl
#!/bin/bash
echo "hello"
su - sasadm <<EOF
source path_to_the_file/db_auth.c fg
DB_PASSWORD=$(eval echo ${DB_PASSWORD} | base64 --decode)
echo Now I am sasadm
id
echo "yes!"
EOF
whoami
runbatch –f /sasem/sas94m2/config/Lev1 || exit 0
case “$1” in
start)
echo –n “$./sas.server ”
/sasem/sas94m2/config/Lev1
cat <<EOF > file1
;;
stop)
echo –n “$./sas.server”
/sasem/sas94m2/config/Lev1
cat <<EOF > file2
;;
*)
echo “Usage: / start|stop|”
exit 1
;;
esac
1. switch user: su - sasadm.
2. decode: DB_PASSWORD
3. run a command line process that start and stop a job
4. print out sas processes that are run to a log (based on the sas.server stop command)
5. give the user the option to start or stop jobs:
6. print out sas that have stop to a log (based on the sas.server stop command)
When I start and stop the job from the command line, I do the following:
$ ./sas.server start ---- it prints out to the terminal sas processes that are started
$ ./sas.server stop ---- it prints out to the terminal sas processes that have stopped
Here is my code: It is not working:
file name that stores password:db_auth.cfg
DB_PASSWORD=Z29vZ2xl
#!/bin/bash
echo "hello"
su - sasadm <<EOF
source path_to_the_file/db_auth.c
DB_PASSWORD=$(eval echo ${DB_PASSWORD} | base64 --decode)
echo Now I am sasadm
id
echo "yes!"
EOF
whoami
runbatch –f /sasem/sas94m2/config/Lev1
case “$1” in
start)
echo –n “$./sas.server ”
/sasem/sas94m2/config/Lev1
cat <<EOF > file1
;;
stop)
echo –n “$./sas.server”
/sasem/sas94m2/config/Lev1
cat <<EOF > file2
;;
*)
echo “Usage: / start|stop|”
exit 1
;;
esac
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.