• sudo sh -c "pkill Xorg && systemctl suspend" but it doesn't kill Xorg

    From Ottavio Caruso@21:1/5 to All on Tue Sep 27 11:27:02 2022
    Hi,

    Debian Stable + latest bash.

    If I issue:

    $ sudo pkill Xorg

    the system will kill Xorg and present me with a new login screen (LightDM)

    However :

    $ sudo sh -c "pkill Xorg && systemctl suspend"

    Just suspends my laptop.

    If I wake the laptop, it resumes without killing Xorg.

    What am I doing wrong?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to ottavio2006-usenet2012@yahoo.com on Tue Sep 27 13:01:26 2022
    In article <tguj5q$1nic$1@dont-email.me>,
    Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Hi,

    Debian Stable + latest bash.

    If I issue:

    $ sudo pkill Xorg

    the system will kill Xorg and present me with a new login screen (LightDM)

    However :

    $ sudo sh -c "pkill Xorg && systemctl suspend"

    Just suspends my laptop.

    If I wake the laptop, it resumes without killing Xorg.

    You probably need a sleep in there, to give Xorg time to go away, before the
    OS is suspended.

    --
    Shikata ga nai...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to All on Tue Sep 27 14:16:34 2022
    In article <tgus76$2180v$1@news.xmission.com>,
    ...
    $ sudo sh -c "pkill Xorg && systemctl suspend"

    Just suspends my laptop.

    If I wake the laptop, it resumes without killing Xorg.

    You probably need a sleep in there, to give Xorg time to go away, before the >OS is suspended.

    I should add that you also probably don't need "sudo" at all.

    Like you, I used to use "sudo" to kill the Xorg process (which usually runs
    as root - although not necessarily - see below), but the fact is that you
    can usually kill some other process - downstream of Xorg - that is running
    as you (and thus won't need sudo), and this will cause the Xorg process to shutdown in due time. The process that I usually kill is called "lxsession".

    BTW, off-topic in shell newsgroup. Probably more of a "Linux type" question.

    Footnote: Hyper-modern versions of Linux now run the X process as the user, rather than as root. You can recognize these hyper-modern versions by the
    fact that the X process ends up running on, say, tty1, instead of, say, tty7.

    Footnote 2: There should be a way to more programatically exit the X
    process, rather than having to mess around with killing processes...

    (In the previous sentence, the word "should" can (and should) be
    interpreted in multiple ways)

    --
    https://en.wikipedia.org/wiki/Mansplaining

    It describes comp.lang.c to a T!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Ottavio Caruso on Tue Sep 27 18:12:26 2022
    On 2022-09-27, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    If I wake the laptop, it resumes without killing Xorg.

    What am I doing wrong?

    The default signal sent by kill and pkill is SIGTERM. That's a catchable signal; it's not guaranteed to be fatal. An application can ignore
    the signal, catch it and do nothing, or catch it and precipitate into
    an orderly shutdown --- executing millions of instructions more code
    until it terminates. Even if the program is designed to catch SIGTERM
    and terminate, something could go wrong between those two events
    to thwart the developer's good intentions, like the program getting
    stuck somewhere, waiting for some external event that never comes
    or getting into an infinite loop.

    To kill something for sure, you must use the SIGKILL signal.

    A reasonable middle ground is to use SIGTERM first, then wait for some reasonable amount of time so the application has a chance to do a
    graceful shutdown, and then SIGKILL.

    "kill" is the name of a system library function, and of a command.
    But what that function and command do isn't killing; they are signal
    sending functions that have been misnamed by Unix.

    kill(pid, sig); // send signal number sig to process pid.

    Sending a signal results in termination only when that is the
    effect of the specific signal which is used.

    You can't take words too literally in computing. E.g. "print" rarely
    does anything with paper any more; "opening" a file is nothing like a
    opening a door, job position or a bank account, etc.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Legal Occupier@21:1/5 to Kenny McCormack on Wed Sep 28 11:05:45 2022
    On 27/09/2022 14:01, Kenny McCormack wrote:
    In article <tguj5q$1nic$1@dont-email.me>,
    Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Hi,

    Debian Stable + latest bash.

    If I issue:

    $ sudo pkill Xorg

    the system will kill Xorg and present me with a new login screen (LightDM) >>
    However :

    $ sudo sh -c "pkill Xorg && systemctl suspend"

    Just suspends my laptop.

    If I wake the laptop, it resumes without killing Xorg.

    You probably need a sleep in there, to give Xorg time to go away, before the OS is suspended.


    I waited half an hour.

    --
    "WARNING: YOU MAY BE BREAKING THE LAW!"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Legal Occupier@21:1/5 to Kenny McCormack on Wed Sep 28 11:06:49 2022
    On 27/09/2022 15:16, Kenny McCormack wrote:
    In article <tgus76$2180v$1@news.xmission.com>,
    ...
    $ sudo sh -c "pkill Xorg && systemctl suspend"

    Just suspends my laptop.

    If I wake the laptop, it resumes without killing Xorg.

    You probably need a sleep in there, to give Xorg time to go away, before the >> OS is suspended.

    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted





    --
    "WARNING: YOU MAY BE BREAKING THE LAW!"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to All on Wed Sep 28 10:10:21 2022
    In article <th16bp$bbii$3@dont-email.me>,
    ...
    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted

    Reading is obviously not your strong suit.

    --
    Hindsight is (supposed to be) 2020.

    Trumpers, don't make the same mistake twice.
    Don't shoot yourself in the feet - and everywhere else - again!.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Kenny McCormack on Sun Mar 5 17:01:13 2023
    On Wednesday, September 28, 2022 at 5:10:27 AM UTC-5, Kenny McCormack wrote:
    In article <th16bp$bbii$3...@dont-email.me>,
    ...
    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted

    Reading is obviously not your strong suit.

    --
    Hindsight is (supposed to be) 2020.

    Trumpers, don't make the same mistake twice.
    Don't shoot yourself in the feet - and everywhere else - again!.gdtdtddyddgf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Jalen Q on Tue Mar 7 13:27:05 2023
    On Sunday, March 5, 2023 at 7:01:16 PM UTC-6, Jalen Q wrote:
    On Wednesday, September 28, 2022 at 5:10:27 AM UTC-5, Kenny McCormack wrote:
    In article <th16bp$bbii$3...@dont-email.me>,
    ...
    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted

    Reading is obviously not your strong suit.

    --
    Hindsight is (supposed to be) 2020.

    Trumpers, don't make the same mistake twice.
    Don't shoot yourself in the feet - and everywhere else - again!.gdtdtddyddgf
    trrdrrdrdrrtyy
    rterwsgsfdgdttdtdydt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Jalen Q on Tue Apr 11 20:18:31 2023
    On Sunday, March 5, 2023 at 7:01:16 PM UTC-6, Jalen Q wrote:
    On Wednesday, September 28, 2022 at 5:10:27 AM UTC-5, Kenny McCormack wrote:
    In article <th16bp$bbii$3...@dont-email.me>,
    ...
    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted

    Reading is obviously not your strong suit.

    --
    Hindsight is (supposed to be) 2020.

    Trumpers, don't make the same mistake twice.
    Don't shoot yourself in the feet - and everywhere else - again!.gdtdtddyddgf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Jalen Q on Sun Apr 16 23:41:10 2023
    On Tuesday, April 11, 2023 at 10:18:51 PM UTC-5, Jalen Q wrote:
    On Sunday, March 5, 2023 at 7:01:16 PM UTC-6, Jalen Q wrote:
    On Wednesday, September 28, 2022 at 5:10:27 AM UTC-5, Kenny McCormack wrote:
    In article <th16bp$bbii$3...@dont-email.me>,
    ...
    I should add that you also probably don't need "sudo" at all.

    $ pkill Xorg
    pkill: killing pid 442065 failed: Operation not permitted

    Reading is obviously not your strong suit.

    --
    Hindsight is (supposed to be) 2020.

    Trumpers, don't make the same mistake twice.
    Don't shoot yourself in the feet - and everywhere else - again!.gdtdtddyddgf
    bvgcgcvgvgctctcvtttgtgttgtgtgtgftt
    ddrrrrerererrrttftftttttrrtrttrrttrttrtttrtrttrtrrttrrtt55itiittiitiiti

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)