# Shell Script to execute another script

**URL:** <https://community.unix.com/t/shell-script-to-execute-another-script/288604>\
**Category:** Shell Programming and Scripting\
**Created:** [May 25, 2011, 12:47am UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604 "2011-05-25T00:47:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddheshk](https://community.unix.com/letter_avatar/siddheshk/32/6_449c533f586939b6e5f246632a46421f.png) [@Siddheshk](https://community.unix.com/u/Siddheshk)\
**Post date:** [May 25, 2011, 12:47am UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604/1 "2011-05-25T00:47:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kumaran\_5555](https://community.unix.com/letter_avatar/kumaran_5555/32/6_449c533f586939b6e5f246632a46421f.png) [@kumaran\_5555](https://community.unix.com/u/kumaran_5555)\
**Post date:** [May 25, 2011, 2:39am UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604/2 "2011-05-25T02:39:52Z")

</div>

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

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

```

In side cron

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

```

---

<div class="post-metadata">

**Author:** ![atul9806](https://community.unix.com/user_avatar/community.unix.com/atul9806/32/6647_2.png) [@atul9806](https://community.unix.com/u/atul9806)\
**Post date:** [May 25, 2011, 5:35am UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604/3 "2011-05-25T05:35:26Z")

</div>

\*/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.

---

<div class="post-metadata">

**Author:** ![clx](https://community.unix.com/letter_avatar/clx/32/6_449c533f586939b6e5f246632a46421f.png) [@clx](https://community.unix.com/u/clx)\
**Post date:** [May 25, 2011, 6:43am UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604/4 "2011-05-25T06:43:17Z")

</div>

What is the OS and version?

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

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

```

---

<div class="post-metadata">

**Author:** ![atul9806](https://community.unix.com/user_avatar/community.unix.com/atul9806/32/6647_2.png) [@atul9806](https://community.unix.com/u/atul9806)\
**Post date:** [May 25, 2011, 10:03pm UTC](https://community.unix.com/t/shell-script-to-execute-another-script/288604/5 "2011-05-25T22:03:49Z")

</div>

thanks anchal.... it worked.. 🙂
