Bug 251108 - net/rsync rc script can't detect daemon status
Summary: net/rsync rc script can't detect daemon status
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-13 17:53 UTC by Ray Bellis
Modified: 2020-11-16 08:06 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (rodrigo)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Bellis 2020-11-13 17:53:54 UTC
The rc.d script for rsyncd appears to be unable to check the status of the running daemon:

```
# service rsyncd status
rsyncd is not running.

# cat /var/run/rsync.pid 
743

# ps auxww | grep rsync
root   743   0.0  0.0 11716  5076  -  Is   17:46    0:00.02 /usr/local/bin/rsync --daemon --config /usr/local/etc/rsync/rsyncd.conf

# pkg info rsync
rsync-3.2.3
Name           : rsync
Version        : 3.2.3
Installed on   : Fri Nov 13 17:35:40 2020 UTC
Origin         : net/rsync
Architecture   : FreeBSD:11:amd64

# uname -r
11.4-RELEASE-p3

```

I believe it's because the process name doesn't match the service name.   I attempted to fix this by setting $procname in the rc script but it didn't help.
Comment 1 Rodrigo Osorio freebsd_committer freebsd_triage 2020-11-15 20:18:26 UTC
Hi,

The status command use the rsync pidfile to locate the running
instance of rsync.

In file /etc/rc.subr:1070
943                 if [ -n "$pidfile" ]; then
944                         _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')'
945                 else
946                         _pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')'
947                 fi

......

1070                 status)
1071                         _run_rc_precmd || return 1
1072                         if [ -n "$rc_pid" ]; then
1073                                 echo "${name} is running as pid $rc_pid."
1074                         else
1075                                 echo "${name} is not running."
1076                                 return 1
1077                         fi
1078                         _run_rc_postcmd
1079                         ;;

I did the test in a 12.2-RELEASE and 11.4-RELEASE and in both environments
`service rsyncd status` returns the correct status about the service.

You can try to debug your environment by making the rc scripts more verbose :
add the following line to your rc.conf before checking the status of the rsyncd service

rc_debug=YES

Without additional information I will close this ticket in the upcoming days.

Cheers,
-- rodrigo
Comment 2 Ray Bellis 2020-11-16 07:49:04 UTC
Thanks for the rc_debug hint.

The error was a mismatch between rsyncd.pid and rsync.pid in the rsync.conf file.
Comment 3 Rodrigo Osorio freebsd_committer freebsd_triage 2020-11-16 08:06:27 UTC
Hi Ray

So the problem was caused by an existing (miss)configuration ? probably by an older version of the port.

I just change the close reason to reflect the real state of the issue. Thanks for your report :)

All the best,
-- rodrigo