# Can't stop rc script



## radiobrain (Dec 1, 2009)

Hello dear Freebsd user, 

I have some problem to make my own rc script based on a simple script. 
I can start my rc script but can't stop it.

/home/synchro/hello.sh:

```
#!/bin/sh
while [ true ]; do
  echo -n 'Hello at '
  date
  sleep 5
done
```


```
-rwxr-xr-x   1 root  wheel         73 Dec  1 10:10 hello.sh*
```


/usr/local/etc/rc.d/hellod.sh:

```
#!/bin/sh
#

# PROVIDE: hello
# REQUIRE: DAEMON
# BEFORE:  cron


. /etc/rc.subr

name="hello"
rcvar=`set_rcvar`

command="/usr/home/synchro/hello.sh"
command_args=" &>> /usr/home/synchro/hello.log"

pidfile="/var/run/hello.pid"

load_rc_config $name
run_rc_command "$1"
```


```
-rwxrwxr-x  1 root  wheel  378 Dec  1 11:08 /usr/local/etc/rc.d/hellod.sh*
```


I can start my rc script like this:
`# /usr/local/etc/rc.d/hellod.sh start`

but i can not stop it:
`# /usr/local/etc/rc.d/hellod.sh stop`

```
hello not running? (check /var/run/hello.pid).
```
When i checked /var/run/hello.pid, the file doesn't exist.
I can only kill the process to stop the script.

What am i missing ? I don't know what more to do.
Can you help me please?


----------



## SirDice (Dec 1, 2009)

The pid file needs to be created by the hello.sh script.


----------

