Using su <username> in Script
I have an application that runs in the evenings that uses 'ntpdate' to sync the machines clock.
My problem is testing 'ntpdate' as a non root user using sudo. The script I am running is executed as root. I want the script to check that everything is working by running 'ntpdate' as a non root user.
i have tried the following:
su dbs1;ntpdate -b <mytimeserver>;exit
but when the script executes it gives me a shell prompt and doesn't continue until I type exit.
Is there anyway I can execute commands in a script as another user without using su, what I need is a reverse sudo command??
Or does anyone know the correct syntax???
|