On Mon, 28 Aug 2017 20:47:40 +0530 Ritesh Raj Sarraf <r...@debian.org> wrote:
> Hello Jakbous,
> 
> On Mon, 2017-08-28 at 13:07 +0200, Jakbous Schürz wrote:
> > I wrote a socket-Unit for systemd, because I don't use inetd.
> > 
> 
> Would you be kind to share your, working, socket based unit file for
> leafnode ?
> 
> IIRC, long back there was some effort by the leafnode maintainer to add
> something like this. But from what I recollect, there were some issues.
> 
> 
> > 
> > "Unlike su, IMO, runuser is made to be used in scripts (so never ask
> > for 
> > password, handle error status better, and also separate signals
> > handling 
> > (new session) from caller"
> > 
> > Would you be so pleasant, to test this and even fix it from su to 
> > runuser?
> 
> I am currently testing with the changes you've mentioned (And would
> like to move to a socket based setup).

For sure :-)

Here are all my units for leafnode:

# systemctl cat leafnode.socket
# /etc/systemd/system/leafnode.socket
[Unit]
Description=Leafnode NNTP Socket

[Socket]
ListenStream=127.0.0.1:119
Accept=true

[Install]
WantedBy=sockets.target
-----------------------------------------

# systemctl cat leafnode@.service
# /etc/systemd/system/leafnode@.service
[Unit]
Description=Leafnode NNTP service
#After=syslog.target
After=systemd-journald.service

[Service]
ExecStart=/usr/sbin/leafnode
StandardInput=socket
User=news
---------------------------------

# systemctl cat leafnode-texpire.service
# /etc/systemd/system/leafnode-texpire.service
[Unit]
Description=leafnode daily texipre newsgroups
ConditionPathExists=

[Service]
User=news
ExecStart=/usr/sbin/texpire

[Install]
WantedBy=timer-daily.target
----------------------------------

# systemctl cat leafnode-touch_groups.service
# /etc/systemd/system/leafnode-touch_groups.service
[Unit]
Description=leafnode daily touch newsgroups
ConditionPathExists=/etc/news/leafnode/touch_groups

[Service]
User=news
ExecStart=/usr/bin/touch_newsgroup -f /etc/news/leafnode/touch_groups
ExecStartPost=/usr/bin/newsq -f

[Install]
WantedBy=timer-daily.target
--------------------------------

# systemctl cat fetchnews.timer
# /lib/systemd/system/fetchnews.timer
[Unit]
Description=Run fetchnews every 10 minutes
DefaultDependencies=false
PartOf=connection-online.target
After=connection-online.target

[Timer]
OnCalendar=*:0/15
AccuracySec=5min
#Persistent=true

[Install]
WantedBy=network-online.target
--------------------------------

# systemctl cat fetchnews.service
# /lib/systemd/system/fetchnews.service
[Unit]
Description=Fetch news for leafnode

[Service]
ExecStart=/usr/sbin/fetchnews


This setup works on my Laptop. I use an own leafnode, becaue i need
groups from more than one news-server, but i only want only one
news-server in my thunderbird.

With sudo in the cron-job, i get the described problems. runuser works
for me (no xdg-user-dirs, no pam-systemd-session...)

regards
Jakob

Attachment: 0x43B88572.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to