Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: How do I restart all processes using systemd?

Hybrid View

  1. #1

    Question How do I restart all processes using systemd?

    I know zypper ps shows all the processes I want to restart but what command do I use to restart them all?

    How do I pipe | all the processes to systemd? Anyone know?

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,330
    Blog Entries
    3

    Default Re: How do I restart all processes using systemd?

    If the only processes that need restarting are user processes (with you as the user), the logout followed by login is probably sufficient. If there are system processes, I do it the easy way -- I just reboot.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by nrickert View Post
    If the only processes that need restarting are user processes (with you as the user), the logout followed by login is probably sufficient. If there are system processes, I do it the easy way -- I just reboot.
    This doesn't seem to work on a live usb sadly.

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,330
    Blog Entries
    3

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by ryanbach View Post
    This doesn't seem to work on a live usb sadly.
    Rebooting always works, in the sense that all processes are restarted.

    After rebooting, if "zypper ps" still shows some processes using deleted files, then just ignore that. I'm currently using GDM for login. And, on Tumbleweed, there are always a few deleted files being used by "gdm". So that's just something "gdm" does. There's no need to restart it.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  5. #5

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by nrickert View Post
    Rebooting always works, in the sense that all processes are restarted.

    After rebooting, if "zypper ps" still shows some processes using deleted files, then just ignore that. I'm currently using GDM for login. And, on Tumbleweed, there are always a few deleted files being used by "gdm". So that's just something "gdm" does. There's no need to restart it.
    I am using kde, btw.

  6. #6
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,257

    Default Re: How do I restart all processes using systemd?

    Is there a specific reason that you cannot simply reboot, or is this a file parsing exercise for amusement?
    Some services should be restarted by the user-owner, and others by root. If display-manager is restarted you will be logged out of KDE anyway. The kernel can only be changed by rebooting.

    You should be thinking of commands like sed, awk, and tr. For instance this might restart all the enabled service units -- and no I haven't tried it. and it's pretty pointless in the real world:
    Code:
    # systemctl reboot `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/s/ .*$/ /p' |tr -d '\n'`
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

  7. #7

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by eng-int View Post
    Is there a specific reason that you cannot simply reboot, or is this a file parsing exercise for amusement?
    Some services should be restarted by the user-owner, and others by root. If display-manager is restarted you will be logged out of KDE anyway. The kernel can only be changed by rebooting.

    You should be thinking of commands like sed, awk, and tr. For instance this might restart all the enabled service units -- and no I haven't tried it. and it's pretty pointless in the real world:
    Code:
    # systemctl reboot `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/s/ .*$/ /p' |tr -d '\n'`
    # systemctl reboot `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/s/ .*$/ /p' |tr -d '\n'`
    Too many arguments.

    Close... Ty.

  8. #8
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,257

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by ryanbach View Post
    # systemctl reboot `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/s/ .*$/ /p' |tr -d '\n'`
    Too many arguments.
    Sorry, my bad. I meant “systemctl restart”, but it still might be too long. Please explain why you are doing this and not just “systemctl reboot” or somesuch -- as I said it seems pointless.
    Code:
     # systemctl restart  `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/ s/.service.*$/ /p' | tr -d '\n'`
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

  9. #9

    Default Re: How do I restart all processes using systemd?

    Quote Originally Posted by eng-int View Post
    Sorry, my bad. I meant “systemctl restart”, but it still might be too long. Please explain why you are doing this and not just “systemctl reboot” or somesuch -- as I said it seems pointless.
    Code:
     # systemctl restart  `systemctl list-unit-files --type=service --state=enabled --all |sed -n '/enabled/ s/.service.*$/ /p' | tr -d '\n'`
    I am trying to update my system because when I reboot it doesn't seem to save. I may have to do this in the future when yast2 installer is fixed for my usb thumbdrive.

  10. #10

    Default Re: How do I restart all processes using systemd?

    Hi,

    Just an alternative using awk.

    Code:
    systemctl list-unit-files --type=service --state=enabled --all | awk '$NF == "enabled" {sub(/\.service/,"",$1); printf "%s ", $1}'
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •