# Service (8)



## hruodr (Nov 25, 2020)

I am really curious to know what does the command: `service lockd onestart`

By experience obviously not to call `rcpbind`, `rcp.statd` and `rpc.lockd` if not running.

This is a question for all that find the rc.d system of FreeBSD (NetBSD) fantastic.


----------



## Phishfry (Nov 26, 2020)

hruodr said:


> By experience obviously not to call `rcpbind`, `rcp.statd` and `rpc.lockd` if not running.


It is to call rpc.lockd





						rpc.lockd
					






					www.freebsd.org
				




You can also see by looking at the rc file in /etc/rc.d/lockd
"NFS file locking daemon"

# Make sure that we are either an NFS client or server, and that we get
# the correct flags from rc.conf(5).
#
name="lockd"
command="/usr/sbin/rpc.${name}"


----------



## hruodr (Nov 26, 2020)

When I start it with service, it works, when I call it manually, it does not, hence it cannot be the same. That is what I wrote before.

I call them without flags, perhaps service use some flags? (I do not have them in rc.conf)

To add locking to working nfs I call `service lockd onestart` in the client and in the server server. I want to see how to do it with bare commands.

EDIT: it seems to call the three is enough, but sometimes fail. No idea what is different with service.


----------



## Phishfry (Nov 26, 2020)

When you run onestart for lockd it will start the other required services.
REQUIRE: nfsclient nfsd rpcbind statd

So perhaps you are not manually starting them in the right order or perhaps you need to give each service time to start up before proceeding to the next required service. nfsclient may take more time to start than the others.


----------



## Phishfry (Nov 26, 2020)

Perhaps you could automatically start NFS Client and use rcorder (8) to see what order the services are loaded.

/etc/rc.conf

```
#### NFS Client ####
nfs_client_enable="YES"
nfs_client_flags="-n 4"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
```
Then reboot and run `rcorder` to see how things startup.
`rcorder /etc/rc.d/* /usr/local/etc/rc.d/*`


----------

