# FreeBSD RC vs NetBSD RC?



## Deleted member 66267 (Feb 3, 2021)

Are they compatible? And compatible to which extent? Could I reuse RC scripts of a pkgsrc port for my FreeBSD port? Thanks.


----------



## vermaden (Feb 3, 2021)

FreeBSD imported *rc.d(8)* from NetBSD so they will require very little modifications (if any).

Here are examples of */etc/rc.d/ftpd* from FreeBSD 12.2 and NetBSD NetBSD 9.99.77.

*NetBSD:*

```
% cat /etc/rc.d/ftpd
#!/bin/sh
#
# $NetBSD: ftpd,v 1.3 2005/08/09 14:59:33 peter Exp $
#

# PROVIDE: ftpd
# REQUIRE: LOGIN
# KEYWORD: shutdown

$_rc_subr_loaded . /etc/rc.subr

name="ftpd"
rcvar=$name
command="/usr/libexec/${name}"
command_args="-D"
pidfile="/var/run/${name}.pid"

load_rc_config $name
run_rc_command "$1"
```



*FreeBSD:*

```
% cat /etc/rc.d/ftpd
#!/bin/sh
#
# $FreeBSD: releng/12.2/libexec/rc/rc.d/ftpd 298514 2016-04-23 16:10:54Z lme $
#

# PROVIDE: ftpd
# REQUIRE: LOGIN FILESYSTEMS
# KEYWORD: shutdown

. /etc/rc.subr

name="ftpd"
desc="Internet File Transfer Protocol daemon"
rcvar="ftpd_enable"
command="/usr/libexec/${name}"
pidfile="/var/run/${name}.pid"
start_precmd=ftpd_prestart

ftpd_prestart()
{
        rc_flags="-D ${rc_flags}"
        return 0
}

load_rc_config $name
run_rc_command "$1"
```


----------

