[solved] How to restart all services with systemd?

I had the habit of restarting all daemons after an upgrade so to make sure the newest libraries, configuration files etc were loaded. I did that with a shell script that restarted the daemons in order which they were listed in rc.conf. With systemd I could do something similar by first getting a list of running services and ordering a 'systemcrl restart  <servicename>' for each. But since systemd keeps track of dependencies I wonder if that would be the way to do it. Also I would need to filter out 'one shot' type services that are only needed on bootup.
<edit>restart instead of reload</edit>
<edit>solved it with a little script</edit>
Last edited by rwd (2012-11-27 21:02:02)

I think that's what systemctl snapshot does.
snapshot [NAME]
           Create a snapshot. If a snapshot name is specified, the new snapshot will be named after it. If none is specified an automatic snapshot name is generated. In either case, the snapshot name used is printed to STDOUT, unless --quiet is specified.
           A snapshot refers to a saved state of the systemd manager. It is implemented itself as a unit that is generated dynamically with this command and has dependencies on all units active at the time. At a later time the user may return to this state by using the isolate command on the snapshot unit.
           Snapshots are only useful for saving and restoring which units are running or are stopped, they do not save/restore any other state. Snapshots are dynamic and lost on reboot.
Then, isolate emergency.target or rescue target and switch to the snapshot.

Similar Messages

  • How to restart OracleXe service in windowsXP?

    how to restart OracleXe service in windowsXP?
    by sample for restart: mysql:
    service mysql restart
    OracleXE howto?
    thanks

    go to
    Start > Settings > Control Panel > Administrative Tools > Services
    Look for the Oracle Database Service. If I remember correctly, it's something like Ora<Instance_name>.
    Hit the Restart button, it's the button with the icon that's a stop and start.

  • Give helpdesk ability to restart ALL SERVICES without making them local or domain administrators

    I have a windows server 2012 environment using Active directory.  I need to give my helpdesk group the ability to stop, start or restart all services on the machines located within an OU, but I do not want to make them local admins because I don't want
    them to be able to install software, create users etc. 
    I have found articles that allow you to grant this right on a PER SERVICE basis, but I am looking for a solution that allows them to restart any service...not just named services.  
    Any help would be greatly appreciated!
    -Brian

    > I have found articles that allow you to grant this right on a PER
    > SERVICE basis, but I am looking for a solution that allows them to
    > restart any service...not just named services.
    http://waynes-world-it.blogspot.de/2009/10/service-control-manager-security-for.html
    http://serverfault.com/questions/37721/how-do-i-grant-users-the-ability-to-install-windows-services
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • How to integrate Note Service with the webservice space?

    Hi
    Can anyone please guide me how to integrate *"Note Service"* with the webcenter spaces. I need to implement "Personal Note" in my webcenter space application. Please can anyone give me article showing step by step procedure to implemennt note service with webcenter spaces or some sample examples.
    Regards
    Raj

    Hi
    Already i have seen this document, here they did not mention how to get the "Note TaskFlow" in resource catalog. In Resource catalog I didn't find any component named "Note TaskFlow".
    To make it visible in resource catalog. What should I do?
    To integrate Webcenter Services(link, mail, notes, etc..) with webcenter spaces, what do i need to do? Itseems all services are in the form of taskflows. How can i make it enable and to bring it in resource catelog?
    Regards
    Raj

  • How to delete all mails with one klick?

    It's annoying to delete every single mail.
    How to delete all mails with one klick, like in the paperbasket?
    Thanks

    If the emails have been previously deleted (I.e. in the trash folder), tap Edit at the top of the list. You should see a delete all button at the bottom. If the messages are in a standard folder, they need to be handled one at a time.

  • How to restart iPhone 5 with broken power button and frozen home button?

    How to restart iPhone 5 with broken power button and frozen home button?

    hmm..just realised that waiting here for answer is like watching paint drying.. Thanks Apple!
    So best option is..
    1) backup your phone
    2) log to iCloud
    3) erese your phone
    4) pug and restore your phone from backup
    .. I'm clearly starting to dislike this company and seriously considering switching to someone else.

  • [SOLVED] How to restart services compatibly with SysVinit

    I'm collaborating on a Kubuntu user's package of scripts for Thinkpad X220 Tablets.  As part of the installation process of the package, the acpid daemon must be restarted to reload newly installed ACPI hooks.  On Kubuntu, the command to restart acpid is:
    service acpid restart
    According to this page, that should work with systemd, as well.  However, this does not work on my Arch Linux system because the 'service' executable does not exist on my PATH.  There is a 'service' executable in the pm-utils package, but it depends on the existence of a SysVinit script in /etc/rc.d; Arch uses a systemd service file instead.  (Besides, why would something like this be in the pm-utils package, not systemd?)
    Using the native systemd command
    systemctl restart acpid
    works fine for me, but it would be nice to use a single command that's compatible for both systems because it needs to go into a makefile that is used on both systems.  Is it possible to use the same command under SysVinit and systemd to restart a service?
    Last edited by kwehmu (2013-11-12 06:37:39)

    progandy wrote:
    The right way to detect systemd would be this:
    if command -v systemd-notify >/dev/null && systemd-notify --booted; then
    echo SYSTEMD
    else
    echo "SOMETHING ELSE (call rc.d, service, ...)"
    fi
    Thanks, that's helpful.  I'm still wondering why 'service <name> restart' doesn't work, though.  According to the documentation on systemd's website, it should.  Why do you think it doesn't work?  (Is the documentation incorrect, am I misreading the documentation, is 'service' part of another package, etc?)
    tomk wrote:Absolutely, this should be left to the user. The Arch way to handle this is with a post-install message, nothing more.
    That makes sense, especially for restarting services.  I haven't found any guidelines, though, on what should/shouldn't be included in installation hooks.  For example, 'media-player-info' runs 'udevadm hwdb --update' after installation to update udev's hardware database, and font packages such as 'ttf-dejavu' run multiple commands to update the font database.  What are some guidelines (or where can I find them) on what I should/shouldn't include?

  • [SOLVED] Can not shutdown/restart from KDE with systemd

    Hello,
      Recently, following I switched to a pure systemd setup.  The process was simple and most things worked "right out of the bpx".  However, I can not shutdown or restart from KDE!
    Let's say that I do the 3 finger salute (ALT-CTRL-DEL) and select "Turn off computer" what I get is KDE shutting down, but then I will only get a console (TTY) login prompt.  Pressing ALT-CTRL-DEL then will trigger a reboot.  I can also login and use "systemctl poweroff".  However, I don't understand why it doesn't work straight from KDE.
    Are there some packages I must install?  Are there some systemd services that I must enable?  What other relevant info should I include in this post?
    Active units :
    UNIT LOAD ACTIVE SUB JOB DESCRIPTION
    proc-sys...misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
    sys-devi...d-card0.device loaded active plugged MCP79 High Definition Audio
    sys-devi...da-sda1.device loaded active plugged ST9500420ASG
    sys-devi...da-sda2.device loaded active plugged ST9500420ASG
    sys-devi...da-sda3.device loaded active plugged ST9500420ASG
    sys-devi...da-sda4.device loaded active plugged ST9500420ASG
    sys-devi...da-sda5.device loaded active plugged ST9500420ASG
    sys-devi...da-sda6.device loaded active plugged ST9500420ASG
    sys-devi...ock-sda.device loaded active plugged ST9500420ASG
    sys-devi...et-eth0.device loaded active plugged RTL8111/8168B PCI Express Gigabit Ethernet controller
    sys-devi...t-wlan0.device loaded active plugged AR928X Wireless Network Adapter (PCI-Express)
    sys-devi...y-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0
    sys-devi...y-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1
    sys-devi...y-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
    sys-devi...y-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
    sys-module-fuse.device loaded active plugged /sys/module/fuse
    -.mount loaded active mounted /
    dev-hugepages.mount loaded active mounted Huge Pages File System
    dev-mqueue.mount loaded active mounted POSIX Message Queue File System
    home.mount loaded active mounted /home
    run-user-1000-gvfs.mount loaded active mounted /run/user/1000/gvfs
    sys-fs-f...nections.mount loaded active mounted FUSE Control File System
    sys-kernel-debug.mount loaded active mounted Debug File System
    tmp.mount loaded active mounted /tmp
    cups.path loaded active waiting CUPS Printer Service Spool
    systemd-...d-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
    systemd-...word-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
    bluetooth.service loaded active running Bluetooth service
    colord-sane.service loaded active running Daemon for monitoring attached scanners and registering them with colord
    colord.service loaded active running Manage, Install and Generate Color Profiles
    console-...daemon.service loaded active running Console Manager
    console-...-start.service loaded active exited Console System Startup Logging
    cups.service loaded active running CUPS Printing Service
    dbus.service loaded active running D-Bus System Message Bus
    [email protected] loaded active running Getty on tty1
    kdm.service loaded active running K Display Manager
    NetworkManager.service loaded active running Network Manager
    sshd.service loaded active running OpenSSH Daemon
    systemd-journald.service loaded active running Journal Service
    systemd-logind.service loaded active running Login Service
    systemd-...s-load.service loaded active exited Load Kernel Modules
    systemd-...unt-fs.service loaded active exited Remount Root and Kernel File Systems
    systemd-sysctl.service loaded active exited Apply Kernel Variables
    systemd-...-setup.service loaded active exited Recreate Volatile Files and Directories
    systemd-...rigger.service loaded active exited udev Coldplug all Devices
    systemd-udevd.service loaded active running udev Kernel Device Manager
    systemd-...ssions.service loaded active exited Permit User Sessions
    systemd-...-setup.service loaded active exited Setup Virtual Console
    udisks2.service loaded active running Storage Daemon
    upower.service loaded active running Daemon for power management
    wpa_supplicant.service loaded active running WPA supplicant
    cups.socket loaded active running CUPS Printing Service Sockets
    dbus.socket loaded active running D-Bus System Message Bus Socket
    systemd-initctl.socket loaded active listening /dev/initctl Compatibility Named Pipe
    systemd-journald.socket loaded active running Journal Socket
    systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
    systemd-...control.socket loaded active listening udev Control Socket
    systemd-...-kernel.socket loaded active running udev Kernel Socket
    basic.target loaded active active Basic System
    cryptsetup.target loaded active active Encrypted Volumes
    getty.target loaded active active Login Prompts
    graphical.target loaded active active Graphical Interface
    local-fs-pre.target loaded active active Local File Systems (Pre)
    local-fs.target loaded active active Local File Systems
    multi-user.target loaded active active Multi-User
    network.target loaded active active Network
    remote-fs.target loaded active active Remote File Systems
    sockets.target loaded active active Sockets
    sound.target loaded active active Sound Card
    swap.target loaded active active Swap
    sysinit.target loaded active active System Initialization
    systemd-...es-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
    LOAD = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB = The low-level unit activation state, values depend on unit type.
    JOB = Pending job for the unit.
    72 units listed. Pass --all to see inactive units, too.
    Last edited by Prozzaks (2012-08-20 17:35:48)

    Demon wrote:For me the system only halts, it does not poweroff. How I can solve this?
    As bgc1954 said, there is also a symlink "/sbin/poweroff". Just edit the file "/usr/share/config/kdm/kdmrc", go to [shutdown] an replace the line "HaltCmd=/sbin/halt" with "HaltCmd=/sbin/poweroff".

  • [solved...] How to REstart a service?

    I'd like to "RE"start a service; which means that i want to stop and start a service only if it was running, but If i do systemctl restart myservice, systemd will start it even if it was stopped.
    Also, systemctl report a successful status in stopping an already stopped service, try by yourself!
    TravelMate koko # systemctl stop sshd ; echo $?
    0
    TravelMate koko # systemctl stop sshd ; echo $?
    0
    ...i dont think this is right at all, it is not possible to stop a stopped thing, so it should return error imho.
    Anyway, is there a simple way of REstarting a service only if it was running?
    Thanks.
    Last edited by kokoko3k (2014-12-30 15:44:04)

    ANOKNUSA wrote:An exit code of '0' just means the command didn't run into any "failure" conditions. It can mean either that the process succeeded, or that the process had nothing to do. You'd get a non-zero return if you tried to start or stop a non-existent service, and systemd would spit out an error message.
    Unfortunately, it is not; at least in an unconsistent systemd world.
    Indeed, i managed to solve the issue this way:
    systemctl status sshd && systemctl restart sshd
    Also see:
    # systemctl stop sshd ; systemctl status sshd ; echo $?
    ● sshd.service - OpenSSH Daemon
    Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
    Active: inactive (dead) since mar 2014-12-30 16:40:34 CET; 7ms ago
    Main PID: 3016 (code=exited, status=0/SUCCESS)
    3
    To summarize, if the service is stopped:
    systemctl status returns a non zero code.
    systemctl stop returns a zero code.
    As for your restarting issue, systemd's behavior seems logical.
    It seems the opposite to me.
    Marking as solved, but still...

  • How to start NetworkManager sooner with systemd?

    I couldn't find this problem on the wiki or on the forum, so I'm posting it. Sorry if I missed something and it was already discussed.
    So I've upgraded to systemd and everything went smoothly, except for one silly issue. Namely, for some reason now NetworkManager seems to start later in the boot process (than it used to before migrating to systemd), and when my KDE loads, there is still no connection and the picture-of-the-day plasmoid and weather wallpaper cannot access the internet and therefore display errors. In couple of seconds the connection is established, but, since these widgets update only once an hour or so, they still show errors for quite a long time, unless manualy updated.
    This issue was not present before migrating to systemd, NetworkManager was able to establish the connection before KDE loaded.
    That's a bit annoying and I couldn't find a way to fix it. Obviously, it should be solved by forcing NetworkManager to start earlier in the boot process (so that it would have time to establish the connection before KDE loads), but I couldn't find how to do it properly. I've read that it's possible to set "before"/"after" properties for units, so, in principle, modifying NetworkManager unit and listing all other available units in the "before" section could work, but it seems to be a very ugly solution.
    Enabling NetworkManager-wait-online.service just increases the boot time by 6 seconds, but doesn't solve the problem.
    Last edited by jerf (2012-11-13 13:15:52)

    Ah, ok, the network manager is started by the multiuser target,
    but it does not yet complete it's tasks, before KDE starts. Have
    you read the systemd concerning part of the wiki entry for the
    network manager? Especially the part „Network services with
    NetworkManager dispatcher“? It mentions how to handle Programs
    which depend on the network interfaces to be configured (by the
    network manager).
    Last edited by Lord Bo (2012-11-13 17:26:56)

  • [Solved] Running mpd as user mpd with systemd without using mpd.conf

    Maybe this is tivial, but I searched about an hour without any results. I want to run mpd as user mpd. I cant use the mpd config file since mpd set the UID and GID explicitely resulting in mpd not having the necessary supplementary groups to access the locally shared music on my pc. Well I tried to run mpd with systemd by
    # systemctl start mpd
    and  the systemd contains the user mpd
    $ cat /etc/systemd/system/default.target.wants/mpd.service
    [Unit]
    Description=Music Player Daemon
    After=network.target sound.target
    [Service]
    User=mpd
    ExecStart=/usr/bin/mpd --no-daemon
    # allow MPD to use real-time priority 50
    LimitRTPRIO=50
    LimitRTTIME=-1
    # move MPD to a top-level cgroup, as real-time budget assignment fails
    # in cgroup /system/mpd.service, because /system has a zero real-time
    # budget; see
    # http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/
    ControlGroup=cpu:/mpd
    # assign a real-time budget
    ControlGroupAttribute=cpu.rt_runtime_us 500000
    [Install]
    WantedBy=default.target
    but it did not run as mpd.
    Well how can I run mpd as mpd? Is there a way to do it like with dropbox: dropbox@<user>.service
    Last edited by manuelschneid3r (2015-03-25 12:52:52)

    Glad you solved it. Was just typing a response and I'll still add two remarks:
    The ps|grep output showed that you run grep as root, not mpd itself (which won't have a space in the command -- the second time it only worked because the mpd group is preceded by a space).
    It sounds like it took you a while to find the drop-in configuration snippet in the mpd.service.d directory. These drop-in are shown in `systemctl status`, which is something you'd normally check in situations like these, and that might help to discover them more quickly.
    Last edited by Raynman (2015-03-25 12:58:36)

  • How to create web services with complex objects as parameters

    Hi,
    Not sure if this is the right place, but...
    I'm using Netbeans 5.5 and trying to learn web services.
    Creating a simple web service with simple parameters like strings and integers is nice and easy. I'm now trying to take the next step, and create a web service with a more complex schema as a parameter.
    I've tried two approaches, and hit dead ends on both:
    (1) Define my complex schema as an xsd file, and then create a WSDL file. Creating the schema and saving it in my EFB project works fine; when I try to create a new WSDL file, the IDE gives me a button to import external schemas - which is where the problem is: the Browse simply won't find my newly created schema file.
    (2) Define a Java class (in this case, it's a fairly simple example containing a single ArrayList), and then use the IDE to generate a web service from Java. The IDE does this fine, but I now have no idea how to consume or test the web service - I don't know where to look for the WSDL that has presumably been generated, and I'm also a bit iffy over what answers to give the WSDL creator about port names etc.
    Ideally, I'd prefer to get approach 1 to work - can someone point me in the direction of a sensible tutorial for these things?
    (Happy to carry on using Netbeans 5.5 or to revert to Sun Studio Enterprise, which I was playing with before.)
    All help appreciated, Thanks

    - For NetBeans related questions, nbusers mailing list is more suited. It is often visited by NetBeans experts.
    http://www.netbeans.org/community/lists/top.html
    ...[email protected]
    The NetBeans users mailing list. General discussion of NetBeans use, this is the place to ask for help and to help others.... (There is a 'Subscribe' button next to the above that you can use to subscribe to the list).
    Can you try posting this question on nbusers list?
    - SJSE 8.1 is based on an older version of NB (NB5.0).
    You should definitely continue with NetBeans, since all development is now being done in NetBeans; all the major JSE modules have been moved to opensource at netbeans.org and are all being developed there. There are as yet no future plans to work on further releases for JSE.
    Please check out http://www.netbeans.org for more details.

  • Remote Restart of Services (with dependencies)

    Hello all,
    i've a short question about restarting a service on a remote machine with powerhell.
    I've tried the following:
    get-service -computername ServerXY -name ServiceXY | Set-Service -Status stopped
    And it works like a charm. But some services have dependencies. For example DFSR:
    PS C:\Windows\system32> get-service -ComputerName ServerXY -name dfsr | Set-Service -Status Stopped
    Set-Service : Cannot stop service 'DFS Replication (dfsr)' because it is dependent on other services.
    At line:1 char:51
    + get-service -ComputerName ServerXY -name dfsr | Set-Service -Status Stopped
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.ServiceProcess.ServiceController:ServiceController) [Set-Servi
    ce], ServiceCommandException
    + FullyQualifiedErrorId : ServiceIsDependentOnNoForce,Microsoft.PowerShell.Commands.SetServiceCommand
    Is there a possiblity to restart services with dependencies remote, too?
    Regards, Heyko

    Instead of Set-Service, use the Stop-Service cmdlet with the -Force parameter in order to stop services that have dependencies. If you want to restart the service, as you've mentioned, then pipe you Get-Service command to the Restart-Service cmdlet. This
    cmdlet will also take the -Force parameter, allowing services to restart even when there are dependent services.
    Update: Added info about the Restart-Service cmdlet.

  • How to configure BIND (chroot) with systemd

    Hello,
    I'm following guide https://wiki.archlinux.org/index.php/BIND_(chroot). In the end there is only said how to enable service in sysvinit environment. Could someone please tell me how to do this with systemd?
    Thanks

    @toogy: what do you mean exactly by creating a systemd service?
    EDIT: for example, I've this one (in /etc/systemd/system/mynamed.service)
    [Unit]
    Description=Internet domain name server
    After=network.target
    [Service]
    ExecStart=/usr/bin/named -f -u named -4
    ExecReload=/usr/bin/rndc reload
    ExecStop=/usr/bin/rndc stop
    [Install]
    WantedBy=multi-user.target
    And according to 'man named', you can use the '-t' parameter if you want named to run in a chroot (I've never tried it):
    -t directory: Chroot to directory after processing the command line arguments, but before reading the configuration file.
    Warning: This option should be used in conjunction with the -u option, as chrooting a process running as root doesn't enhance security on most systems; the way chroot(2) is defined allows a process with root privileges to escape a chroot jail.
    Last edited by scar (2014-03-18 16:24:55)

  • How to use web service with ABAP Web Dynpro

    Hi.
         do you know, how to web service with ABAP Web Dynpro?

    Hi,
    If you have a webservice ready with you then you can generate a proxy from SE80 and you can use that. You just have to create a port and assign to that generated proxy(CLASS) and you are good to go.
    Let me know if you need more information.
    Thank You,
    Gajendra.

Maybe you are looking for

  • I erased a project from iphoto 7.1.5.  how do I get it back?  I have time machine. how do I use it.

    I accidentally erased a photo project but have been unable to retrieve it.  I went into time machine but have been unable to use it to retrieve my project.  I'm not sure if I'm using it correctly or not though.  Any suggestions or is it lost?

  • Several pixel value in one iteration

    Hi, I am still very new to labview and I have a timing problem with a while loop. I am attaching the VI so that it is easier to understand. Basically, I read X and Y voltages (with a PCI card) that correspond to a position in an image (that I load).

  • Determining indexes that are not used in 10g

    Is there a way to identify indexes that are not utilized in 10g? We have ADDM and AWR running nightly. Thanks in advance...

  • Possible to turn off MBP Sleep Light?

    The sleep light on my MBP is bright. The pulsing can actually wake me up. Is it possible to turn it off? The iMac G5 got a "Sleep Indicator Light" update that turns it off at night. I'm not sure if it's configurable or not, but even if it's not, the

  • How do you install and run Java HTML converter 1.2?

    Hi, I just downloaded the Java plugin HTML converter (version 1.2) and after I unzipped the file, there was no exe file to run. Am I supposed to move all the files and directories somewhere else and run something at the command prompt? I wish they ha