Shell Script to execute another script

Hello,

I have a shell script which restart the application. I use following syntax to execute the same.

$./ams_rc stop --> To stop application
#./ams_rc start --> To start application.

As of now it is done manually, and i want to automate the same.

I want to write a shell script which will run from cron and do the above things. I.E. It will frist stop the application, sleep for 30 seconds and then again start the application.

Thanks in Advance.

Regards,
Siddhesh.K

What have you tried so far ? you need to use absolute path in cron

$ cat startup.sh
#!/bin/bash
/absolute/path/ams_rc stop
sleep 30
/absolute/path/ams_rc start

In side cron

*/30 * * * * . /abolute/path/startup.sh 

*/30 * * * * . /abolute/path/startup.sh

When I tried this I got this error

"/tmp/crontabYmucUa" 6 lines, 246 characters
A line of the crontab file:
*/30 * * * * /auto/home/atsingh5/crontest

contains the following error:
0481-079 Reached a symbol that is not expected.

What is the OS and version?

Probably, "*/30 " syntax might not a valid syntax for your OS. try other.
e.g.

0,30 * * * * . /abolute/path/startup.sh

thanks anchal.... it worked.. :slight_smile: