Systemd equivalent to dhclient exit-hooks script

2018-02-28 Thread john doe

Hi,

I configure a dhcp interface using systemd-networkd.
When a new lease is acquired I need to reload some services.
How can I do that?

In other words: I'm looking for a systemd equivalent to dhclient exit 
hooks script.


I'm on Debian 9.

--
John Doe



Re: systemd equivalent

2015-06-15 Thread Darac Marjal
On Fri, Jun 12, 2015 at 05:53:52PM -0400, Bob Bernstein wrote:
 I need to steel myself to using systemd commands. What would be the
 systemd-correct form of this:
 
 $ ps ax | grep ssh
 
 I use that to check for the existence (or, as the case may be)  demise) of
 an ssh tunnel I use for VNC. What should I use?

Not directly answering your question here, but some alternative ways to
ask your system the question Is there an 'ssh' process running?:

$ ps ax | grep [s]sh# Avoids the grep process showing up
$ pgrep ssh # Returns the PID of any 'ssh' processes

 
 
 Thanks all,
 

-- 
For more information, please reread.


signature.asc
Description: Digital signature


Re: systemd equivalent

2015-06-15 Thread Paul E Condon
On 20150612_1753-0400, Bob Bernstein wrote:
 I need to steel myself to using systemd commands. What would be the
 systemd-correct form of this:
 
 $ ps ax | grep ssh
 
 I use that to check for the existence (or, as the case may be)  demise) of
 an ssh tunnel I use for VNC. What should I use?
 
 
 Thanks all,
 

Bob, and other posters on this thread;

In another thread, Bob made reference to the Debian social contract.
Here Bob is trying to discover some experiment that he can do to test,
yes or no, whether his expectation about the answer to a simple query
is still valid under systemd. He could have worded the question as:

Does '$ ps ax | grep ssh' still work under systemd, and does it give
results in same way, or a different way?

But I don't think my suggested rewording is any better than his
orginal wording, just different, with more words, which might have
slowed some readers enough for their minds to keep up with there
eyeballs, so they apprehend what the question really is. Everyone has
expectations. All expectations are pre-conceptions. No one can know
another person's expectations without a conversation. The flame wars
over systemd have muddied the waters about systemd, as has been
recently mentioned by another Bob in another thread on this list.

HTH ;-)

-- 
Paul E Condon   
pecon...@mesanetworks.net


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20150615160931.gb15...@big.lan.gnu



Re: systemd equivalent

2015-06-14 Thread Ansgar Burchardt
Bob Bernstein b...@fanatick.org writes:
 My initial question was _meant_ to be, simply: can this (ps ax|grep
 ssh) be done, or approximated to, using sysctl?

No, systemd is not supposed to replace standard system utilities. (Also
sysctl is a completely unrelated tool to configure kernel parameters;
the systemd utility is systemctl.)

However if you configure your ssh tunnel as a service that systemd
manages, then you can query systemd about its state via systemctl or
directly via systemd's DBus interface:

  Is the service running?
systemctl is-active my-tunnel

  What is the services main process' PID?
systemctl -pMainPID show my-tunnel

Note that there is also a per-user instance of systemd to allow regular
users to use systemd to manage their own services if they choose to do
so. Not everything has to be a system service.

Ansgar


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/87twuawrdh@deep-thought.43-1.org



Re: systemd equivalent

2015-06-14 Thread Brian
On Sun 14 Jun 2015 at 05:14:53 -0400, Bob Bernstein wrote:

 On Sun, 14 Jun 2015, Frederic Marchal wrote:
 
 Why do you think systemd has a way of doing everything other tools
 are designed for?
 
 That's not a thought I have ever harbored or expressed.
 
 My initial question was _meant_ to be, simply: can this (ps ax|grep
 ssh) be done, or approximated to, using sysctl? The first respondent
 seemed to be saying oh yes certainly and here is how to do that. No
 one but me took note that he was, regrettably, wrong.
 
 There is no need for any speculation aimed at getting at what I
 might be thinking about systemd or ps or anything else for that
 matter. If a question arises as to what I am thinking beyond what
 I have typed in an email, just ask me. I don't bite.

I think everyone is trying to point out you have encountered the
age-old Square Peg in a Round Hole conundrum. The Ancient Egyptians
were puzzled by it when building the pyramids and it went on to stump
Euclid. Recent research indicates it is related to the Barking up the
Wrong Tree problem.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20150614111930.gk24...@copernicus.demon.co.uk



Re: systemd equivalent

2015-06-14 Thread Bob Bernstein

On Sun, 14 Jun 2015, Frederic Marchal wrote:

Why do you think systemd has a way of doing 
everything other tools are designed for?


That's not a thought I have ever harbored or 
expressed.


My initial question was _meant_ to be, simply: can 
this (ps ax|grep ssh) be done, or approximated to, 
using sysctl? The first respondent seemed to be saying 
oh yes certainly and here is how to do that. No one 
but me took note that he was, regrettably, wrong.


There is no need for any speculation aimed at getting 
at what I might be thinking about systemd or ps or 
anything else for that matter. If a question arises as 
to what I am thinking beyond what I have typed in an 
email, just ask me. I don't bite.


But when you indicate that you believe you know what 
Brian is thinking, well, all I can imagine is that he 
must be a struggling relative of yours, or something, 
in order to have earned that level of dedicated 
support on your part, although perhaps I do you both a 
disservice with such observations, and if that is the 
case please allow me to make haste to apologize.


Thank you for your reply which was kind and 
well-intentioned. I will pursue my studies of systemd 
with heightened caution and circumspection. These are 
troubled waters indeed, yes?



--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506140441440.4342@arjgebyy.ybpnyqbznva



Re: systemd equivalent

2015-06-14 Thread Sven Arvidsson
On Sat, 2015-06-13 at 16:35 -0400, Bob Bernstein wrote:
 But it turns out I haven't yet found a way to do that, 
 that is, replicate (more or less) the output of 'ps 
 ax| grep ssh' using sysctl commands. They don't seem 
 to register, as it were, my ssh tunnel.

But systemd manages services (daemons) like sshd, but you set up the ssh
tunnel using the client, ssh right?

-- 
Cheers,
Sven Arvidsson
http://www.whiz.se
PGP Key ID 6FAB5CD5




signature.asc
Description: This is a digitally signed message part


Re: systemd equivalent

2015-06-14 Thread Brian
On Sun 14 Jun 2015 at 13:51:47 -0400, Bob Bernstein wrote:

 On Sun, Jun 14, 2015 at 12:19:30PM +0100, Brian wrote:
 
  I think everyone is trying to point out you have encountered 
  the age-old Square Peg in a Round Hole conundrum.
 
 I knew you wouldn't let me down. *plonk*

The objective is not to disappoint.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/14062015192429.8481c2ebb...@desktop.copernicus.demon.co.uk



Re: systemd equivalent

2015-06-14 Thread Bob Bernstein
On Sun, Jun 14, 2015 at 12:19:30PM +0100, Brian wrote:

 I think everyone is trying to point out you have encountered 
 the age-old Square Peg in a Round Hole conundrum.

I knew you wouldn't let me down. *plonk*


-- 
Bob Bernstein

 


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20150614175147.ga7...@sixtiessurvivor.org



Re: systemd equivalent

2015-06-14 Thread Bob Bernstein

On Sun, 14 Jun 2015, Ansgar Burchardt wrote:

No, systemd is not supposed to replace standard 
system utilities.


I have never believed nor claimed that it was thus 
supposed to be anything of the sort. I framed a query 
about it, and various subscribers read into that what 
they wished.


(Also sysctl is a completely unrelated tool to 
configure kernel parameters; the systemd utility is 
systemctl.)


Ah. My bad. Thank you.

However if you configure your ssh tunnel as a 
service that systemd manages, then you can query 
systemd about its state via systemctl or directly 
via systemd's DBus interface:


 Is the service running?
   systemctl is-active my-tunnel

 What is the services main process' PID?
   systemctl -pMainPID show my-tunnel


Thank you.

Note that there is also a per-user instance of 
systemd to allow regular users to use systemd to 
manage their own services if they choose to do so. 
Not everything has to be a system service.


Thank you again. How I love simple facts.

I have suspected all along that my destination was 
very likely configuring my tunnel via systemd, and 
perhaps even building in thereby some stay-alive 
capacity for said tunnel.



--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506141352400.4342@arjgebyy.ybpnyqbznva



Re: systemd equivalent

2015-06-14 Thread Bob Holtzman
On Sun, Jun 14, 2015 at 07:25:36PM +0100, Brian wrote:
 On Sun 14 Jun 2015 at 13:51:47 -0400, Bob Bernstein wrote:
 
  On Sun, Jun 14, 2015 at 12:19:30PM +0100, Brian wrote:
  
   I think everyone is trying to point out you have encountered 
   the age-old Square Peg in a Round Hole conundrum.
  
  I knew you wouldn't let me down. *plonk*
 
 The objective is not to disappoint.

Otherwise stated as we aim to please.

 
 
 -- 
 To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
 with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
 Archive: 
 https://lists.debian.org/14062015192429.8481c2ebb...@desktop.copernicus.demon.co.uk

-- 

Bob Holtzman
A fair fight is the result of poor planning.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20150614225950.ga23...@cox.net



Re: systemd equivalent

2015-06-13 Thread Bob Bernstein

On Sat, 13 Jun 2015, Brian wrote:

You don't mean that, do you? After all, you do use 
its functionality for booting. :)


Thanks for that. You may be right.

BUT...hrrrmmm...just to show that I can be as 
reasonable as the next fellow, allow me to ask if 
perhaps there was something actually helpful you 
wanted to mention here. I know how under the pressure 
of composing a post to a list things can slip one's 
mind.



--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506132246560.4342@arjgebyy.ybpnyqbznva



Re: systemd equivalent

2015-06-13 Thread Frederic Marchal
On Saturday 13 June 2015 22:52:22 Bob Bernstein wrote:
 On Sat, 13 Jun 2015, Brian wrote:
  You don't mean that, do you? After all, you do use
  its functionality for booting. :)
 
 Thanks for that. You may be right.
 
 BUT...hrrrmmm...just to show that I can be as
 reasonable as the next fellow, allow me to ask if
 perhaps there was something actually helpful you
 wanted to mention here. I know how under the pressure
 of composing a post to a list things can slip one's
 mind.

I'm thinking the same thing as Brian when I read your posts. I may be able 
to formulate his point of view differently.

Why do you thing systemd has a way of doing everything other tools are 
designed for?

In that instance, ps is designed to report active tasks. And that's just what 
your ssh tunnel is. It is a child process started by the ssh service started 
by systemd.

Even if the top ssh service was started by systemd, it doesn't mean 
systemd has to provide every possible tool to keep track of everything the 
service might do (thankfully for that I would add!).

You may be lured by the fact that systemd is responsible for the system 
journal. As a consequence, it does provide the tool to show the system log 
but every child process isn't registered in the log (or it might with the 
proper output level if the service support it but that's not the point here).

Hope it helps,

Frederic



Re: systemd equivalent

2015-06-13 Thread Sven Arvidsson
On Fri, 2015-06-12 at 17:53 -0400, Bob Bernstein wrote:
 I need to steel myself to using systemd commands. What 
 would be the systemd-correct form of this:
 
 $ ps ax | grep ssh
 
 I use that to check for the existence (or, as the case 
 may be)  demise) of an ssh tunnel I use for VNC. What 
 should I use?

Not sure I follow, why would you use a different way to list processes
just because you're using systemd?

-- 
Cheers,
Sven Arvidsson
http://www.whiz.se
PGP Key ID 6FAB5CD5




signature.asc
Description: This is a digitally signed message part


Re: systemd equivalent

2015-06-13 Thread Bob Bernstein

On Sat, 13 Jun 2015, Sven Arvidsson wrote:

Not sure I follow, why would you use a different way 
to list processes just because you're using systemd?


Well, the thing is, I am so gunshy about systemd that 
I am _not_ using its functionality for anything right 
now!


SO, I thought I might coax myself into using it by 
finding substitutes for tried-and-true unix commands, 
such as 'ps ax|grep [something].


But it turns out I haven't yet found a way to do that, 
that is, replicate (more or less) the output of 'ps 
ax| grep ssh' using sysctl commands. They don't seem 
to register, as it were, my ssh tunnel.


I wonder if this is a problem with ownership, i.e if 
by default sysctl will not consider processes started 
by non-system users, i.e. what we used to call 
ordinary users. I start my ssh tunnels as such a 
user, not as root or anything else fancy-schmancy.


But then on my system it appears only root can launch 
sysctl. Hrrr.


Thanks. I'm sorry if I seem all over the place here.

--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506131623240.4342@arjgebyy.ybpnyqbznva



Re: systemd equivalent

2015-06-13 Thread Brian
On Sat 13 Jun 2015 at 16:35:39 -0400, Bob Bernstein wrote:

 On Sat, 13 Jun 2015, Sven Arvidsson wrote:
 
 Not sure I follow, why would you use a different way to list
 processes just because you're using systemd?
 
 Well, the thing is, I am so gunshy about systemd that I am _not_
 using its functionality for anything right now!

You don't mean that, do you? After all, you do use its functionality for
booting. :)

 SO, I thought I might coax myself into using it by finding
 substitutes for tried-and-true unix commands, such as 'ps ax|grep
 [something].
 
 But it turns out I haven't yet found a way to do that, that is,
 replicate (more or less) the output of 'ps ax| grep ssh' using
 sysctl commands. They don't seem to register, as it were, my ssh
 tunnel.

systemctl is about *control* of the system. ps is about giving a
*report* on the current pocesses. Coercing either one into doing the
job of the other seems doomed to failure.
 
 I wonder if this is a problem with ownership, i.e if by default
 sysctl will not consider processes started by non-system users, i.e.
 what we used to call ordinary users. I start my ssh tunnels as
 such a user, not as root or anything else fancy-schmancy.

The problem lies outside the province of the software.
 
 But then on my system it appears only root can launch sysctl.
 Hrrr.

If the command 'systemctl' gives no output you have a system problem.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20150613224353.gj24...@copernicus.demon.co.uk



systemd equivalent

2015-06-12 Thread Bob Bernstein
I need to steel myself to using systemd commands. What 
would be the systemd-correct form of this:


$ ps ax | grep ssh

I use that to check for the existence (or, as the case 
may be)  demise) of an ssh tunnel I use for VNC. What 
should I use?



Thanks all,

--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506121750100.917@arjgebyy.ybpnyqbznva



Re: systemd equivalent

2015-06-12 Thread John L. Ries

On Friday 2015-06-12 15:53, Bob Bernstein wrote:


Date: Fri, 12 Jun 2015 15:53:52
From: Bob Bernstein poo...@ruptured-duck.com
To: Debian User List debian-user@lists.debian.org
Subject: systemd equivalent

I need to steel myself to using systemd commands. What
would be the systemd-correct form of this:

$ ps ax | grep ssh

I use that to check for the existence (or, as the case
may be)  demise) of an ssh tunnel I use for VNC. What
should I use?



My usual approach is to look for the name of the service, like so:

systemctl -a|grep ssh

On my Debian/Jessie box, I get:

  ssh.service 
loadedactive   running   OpenBSD Secure Shell server


Then you can check status, like so:

systemctl status ssh.service

Assuming it's running, the output should include a listing of the sshd 
processes running.


I still find systemd to be excessively complicated and the tools 
(especially systemadm) primitive, but at least now I have some idea as 
to how to work the system.


--|
John L. Ries  |
Salford Systems   |
Phone: (619)543-8880 x107 |
or (435)867-8885  |
--|



Thanks all,

--
These are not the droids you are looking for.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/nycvar.QRO.7.75.3.1506121750100.917@arjgebyy.ybpnyqbznva





--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: 
https://lists.debian.org/alpine.LSU.2.11.1506121627210.30769@snypbe.evrfraunhf.ybpny



Re: systemd equivalent

2015-06-12 Thread Bob Bernstein

On Fri, 12 Jun 2015, John L. Ries wrote:


Then you can check status, like so:

systemctl status ssh.service


The output of this command (above) doesn't change 
after a tunnel is started.


My old clunky ps command tells me the tunnel is there:

# ps ax |grep ssh
  458 ?Ss 0:00 /usr/sbin/sshd -D
  904 ?Ss 0:00 /usr/bin/ssh-agent /bin/bash /home/bob/.xsession
 3503 pts/1S+ 0:00 ssh b...@fanatick.org
 3613 ?S  0:00 ssh -N -T -L 4900:localhost:5901 sixtiessurvivor.org 

 3624 pts/3S+ 0:00 grep ssh

But systemd tells me only:

# systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; 
enabled)
   Active: active (running) since Tue 2015-06-09 
21:12:58 EDT; 2 days ago

 Main PID: 458 (sshd)
   CGroup: /system.slice/ssh.service
   └─458 /usr/sbin/sshd -D

Jun 09 21:13:02 newtroll sshd[458]: Server listening 
on 0.0.0.0 port 22.
Jun 09 21:13:02 newtroll sshd[458]: Server listening 
on :: port 22.


Hrrrmmm

--
These are not the droids you are looking for.