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


echo "hello"
su - sasadm <<EOF
source path_to_the_file/db_auth.cfg
DB_PASSWORD=$(eval echo ${DB_PASSWORD} | base64 --decode)
echo Now I am sasadm
echo "yes!"

runbatch –f /sasem/sas94m2/config/Lev1 || exit 0
case “$1” in
           echo –n “$./sas.server ”
           cat <<EOF > file1
          echo –n “$./sas.server”
         cat <<EOF > file2
          echo “Usage: / start|stop|”
          exit 1
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Murugesan NagarajanCommented:

The following line has error:
cat <<EOF > file1

Open in new window

cat <<EOF > file2

Open in new window

cat <<EOF > file1
Write the message you need to overwrite into the file file1

Open in new window

cat <<EOF >> file2
Write the message you need to append
As per your requirement you can use overwrite or append into the file file2

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.