LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2017, 01:49 PM   #1
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Question: Setting up rsyncd under systemd


I have finally gotten around to writing my first systemd unit definition from scratch. It seems to work, but I wanted to ask the experts here at LQ.org if I have done this correctly. This rsync daemon is hit rarely - once a day in the middle of the night - so I wanted it to be socket activated and exit after completing its task, so as not to consume resources when it's not in use. The startup time is of no importance in this application.

Here's what I have:

Newly created file:
/etc/systemd/system/sockets.target.wants/rsyncd.socket
Code:
[Unit]
Description=RSYNC Socket for Per-Connection Servers
ConditionPathExists=/etc/rsyncd.conf

[Socket]
ListenStream=873
Accept=yes

[Install]
WantedBy=sockets.target
Newly created file:
/etc/systemd/system/rsyncd@.service
Code:
[Unit]
Description=RSYNC Per-Connection Server
After=network.target

[Service]
ExecStart=/usr/bin/rsync --daemon
StandardInput=socket
systemctl daemon-reload
systemctl start rsyncd.socket
systemctl status rsyncd.socket

Code:
● rsyncd.socket - RSYNC Socket for Per-Connection Servers
   Loaded: loaded (/etc/systemd/system/sockets.target.wants/rsyncd.socket; bad; vendor preset: enabled)
   Active: active (listening) since Sun 2017-12-03 12:04:26 MST; 5min ago
   Listen: [::]:873 (Stream)
 Accepted: 5; Connected: 0

Dec 03 12:04:26 Davids-Linux-Desktop systemd[1]: Listening on RSYNC Socket for Per-Connection Servers.
(Note: I grabbed the above screenshot later, after the fact, once I had done some additional testing, hence the "Accepted: 5" part.)

netstat -anp | grep LISTEN | grep 873
Code:
tcp6       0      0 :::873                  :::*                    LISTEN      1/init
ps -ef | grep rsync
Code:
root       498 32719  0 12:27 pts/1    00:00:00 grep --color=auto rsync
Looks like it's LISTENing, but rsync is not actively running. Just what I would expect for a socket activated service.

I ran a rsync client from a different computer and it connected and displayed the files I asked for just fine (client command was "rsync -rtd ...") Everything seems good as best I can tell.

systemctl enable rsyncd@.service
No output from this command, but exit value was zero (successful).

Have I done everything correctly above? Or do I have some dastardly misconfiguration somewhere that will come back to bite me later? I googled a bit to come up with the above solution, and it appears to work just like I had hoped, but I wanted to ask the experts here for comments/suggestions/advice since this is my first attempt at systemd. I've been one of the old generation holdouts, using older technologies, finally dragging myself into the future now. Thanks in advance for any tips.
 
Old 12-03-2017, 11:47 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
First of all, rsyncd has the tiniest footprint. You aren't really saving resources. Second, see this for one of the status messages you received, and some links to systemd stuff in general: https://askubuntu.com/questions/8360...s-includes-bad

Try taking the '@' out of the systemctl command.
 
Old 12-04-2017, 09:48 AM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Original Poster
Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by AwesomeMachine View Post
Try taking the '@' out of the systemctl command.
Thanks. Are you recommending that because there is a potential problem with using the socket activated method, or because any resources saved will be small?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync using /etc/rsyncd.secrets cccc Linux - Newbie 5 12-27-2009 11:54 AM
Which is quicker - rsyncd or NFS? brooky9999 Slackware 3 02-11-2008 09:47 PM
rsyncd and ntpd in xubuntu 7.10 v8hadas Ubuntu 1 02-06-2008 09:21 AM
rsyncd.conf file module question bjones Linux - Software 1 11-26-2005 08:21 AM
Where is rsyncd.conf klemen Slackware 2 03-08-2005 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration