Start rtorrent in tmux with systemd

I am trying to setup a server with rtorrent, but it closes or will not run.
[Unit]
Description=rTorrent
Requires=network.target local-fs.target
[Service]
Type=oneshot
RemainAfterExit=yes
KillMode=none
User=nobody
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
[Install]
WantedBy=multi-user.target
I following commands, works find in terminal.
[root@Server ~]# sudo -u nobody tmux new-session -s rt -n rtorrent -d rtorrent
[root@Server ~]# sudo -u nobody tmux send-keys -t rt:rtorrent C-q
[root@Server ~]# sudo -u nobody tmux attach -t rt
So it is not because rtorrent cannot run as nobody, so does anyone know what I am doing wrong?

Not an Arch discussion, moving to Apps & DEs...

Similar Messages

  • [SOLVED] samba does not start properly again -this time with systemd

    Definitely no luck with this one...
    So, today I've switched to a pure systemd init system, and noticed that I have this old issue again.
    (Link to my old thread: https://bbs.archlinux.org/viewtopic.php?id=142704)
    Samba doesn't start properly again, more precisely smbd is launched but not nmbd, so samba is not working as it should (for example smbtreee lists nothing).
    Last time I've solved it by putting samba long before networkmanager in the daemons array, but with systemd I'm a bit confused...
    Anyone has this issue?
    Last edited by scar (2012-11-03 07:05:42)

    I think that nmbd isn't waiting for networkmanager to start on my system, because I'm getting journal entries like
    Oct 31 00:47:21 spacebar winbindd[431]: [2012/10/31 00:47:21.556005, 0] param/loadparm.c:7969(lp_do_parameter)
    Oct 31 00:47:21 spacebar systemd[1]: nmbd.service: main process exited, code=exited, status=1
    Oct 31 00:47:21 spacebar systemd[1]: Unit nmbd.service entered failed state.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): carrier now ON (device state 20)
    Oct 31 00:47:22 spacebar kernel: r8169 0000:03:00.0: eth0: link up
    Oct 31 00:47:22 spacebar kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Auto-activating connection 'Static'.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) starting connection 'Static'
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
    Oct 31 00:47:22 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) started...
    Oct 31 00:47:22 spacebar rpc.mountd[462]: Version 1.2.6 starting
    Oct 31 00:47:22 spacebar systemd[1]: Startup finished in 3s 850ms 155us (kernel) + 21s 279ms 972us (userspace) = 25s 130ms 127us.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> (eth0): device state change: ip-config -> activated (reason 'none') [70 100 0]
    Oct 31 00:47:23 spacebar ntpd_intres[441]: DNS 0.au.pool.ntp.org -> 116.66.160.39
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Policy set 'Static' (eth0) as default for IPv4 routing and DNS.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Activation (eth0) successful, device activated.
    Oct 31 00:47:23 spacebar NetworkManager[391]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.
    Oct 31 00:47:23 spacebar dbus[401]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.771872, 0] param/loadparm.c:7969(lp_do_parameter)
    Oct 31 00:47:20 spacebar smbd[428]: Ignoring unknown parameter "user client driver"
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.794252, 0] lib/interface.c:543(load_interfaces)
    Oct 31 00:47:20 spacebar smbd[428]: WARNING: no network interfaces found
    Oct 31 00:47:20 spacebar smbd[428]: [2012/10/31 00:47:20.805126, 0] smbd/server.c:1109(main)
    Oct 31 00:47:20 spacebar smbd[428]: standard input is not a socket, assuming -D option
    Oh, this started happening after putting a MUCH faster cpu and motherboard in the system, so maybe there's a race-condition there?
    Last edited by MisterAnderson (2012-10-30 04:59:46)

  • How to start dhclient with systemd at startup? [SOLVED]

    I have eth0 connected to DHCP server and want to use dhclient instead of dhcpcd. How can I start dhclient with systemd? Is there something similar to
    systemctl enable dhcpcd@eth0
    Last edited by mpelikan (2012-12-18 13:43:28)

    dhcpcd comes in package with completed systemd unit (/usr/lib/systemd/system/dhcpcd.service and /usr/lib/systemd/system/[email protected]) by package developer, but dhclient doesn't.
    mpelikan, you should write your own systemd unit for dhclient for yourself using
    1) dhcpcd units as example
    2) wiki page https://wiki.archlinux.org/index.php/Sy … vice_files
    3) man page for dhclient to get the right options
    Also I'm sure I saw somewhere an example of dhclient unit but I can't find it now. Anyway, it was not working out-of-box in Arch.
    I've done this previously but then I've realized disadvantages of dhclient (so I've removed it).
    Firstly, I didn't like how it's working in daemon-mode after some testing.
    Secondly, it depends on deprecated net-tools.
    You should try dhcpcd. If it doesn't work, you can make it work by editing configuration files / kernel options (like switching off IPv6 if you think you have an issues with it) or adding some parameters.

  • How to run a command automaticly on starting up with systemd

    Hi,
    I'm using a laptop with two video card, an ATI 3400 and a intel integrated video card.
    Several months ago, I use rc.local to disable the ATI 3400 with the command below:
    mount -t debugfs debugfs /sys/kernel/debug
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    What should I do to enable these commands with systemd?
    Thank You!

    brain0 wrote:
    yumtaoist wrote:
    nomorewindows wrote:Make a .service file and make sure that systemd calls it.
    I have write a video.service file like below
    [Unit]
    Description=Disable the Discrete Graphics
    Requires=sys-kernel-debug.mount
    After=sys-kernel-debug.mount
    [Service]
    Type=oneshot
    ExecStart=echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    And the result of "systemctl is-enabled video.service" is static
    However, this just does not work. I'm not familiar with systemd.
    Buy the way, thank you!
    First of all, put this into /etc/systemd/system/. Then add an install section to this unit:
    [Install]
    WantedBy=multi-user.target
    or
    [Install]
    WantedBy=basic.target
    (No idea which one is better). Then run:
    # systemctl daemon-reload
    # systemctl enable video.service
    Last edited by brain0 (2012-10-27 20:09:25)

  • Gnome and kde not loading with systemd

    Hello!
    I use [testing] repo and after some updates i can't use gnome or kde with systemd anymore.
    * with sysvinit everything works
    * xfce and other wms works fine with systemd and sysv
    * 'gnome-shell --replace' also work in xfce with systemd
    * I've got some errors:
    gnome-session[2301]: WARNING: Application 'gnome-settings-daemon.desktop' failed to register before timeout
    (gnome-settings-daemon:2321): libupower-glib-WARNING **: Couldn't enumerate devices: Activation of org.freedesktop.UPower timed out
    gnome-session[2301]: WARNING: Application 'gnome-shell.desktop' failed to register before timeout
    (gnome-settings-daemon:2321): color-plugin-WARNING **: GDBus.Error:org.freedesktop.ColorManager.Failed: failed to obtain org.freedesktop.color-manager.create-profile auth
    QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
    Object::connect: No such signal QDBusAbstractInterface::DeviceAdded(QString)
    plasma-desktop(2323): Communication problem with  "plasma-desktop" , it probably crashed.
    Error message was:  "org.freedesktop.DBus.Error.Disconnected" : " "Connection was disconnected before a reply was received" "
    I think there is some problems with dbus...

    Without a dbus socket, dbus probably isn't running. It's supposed to be started automatically when a program needs it. Check to see that it is installed and running:
    pacman -Q dbus
    pgrep -l dbus
    Dbus won't run without hal, so hal should be in:
    tail /etc/rc.conf
    Are any of your partitions full?
    df -h
    For the other error, it looks like libdrm isn't installed, but I don't think you need it if you're running the nvidia driver.
    Your xorg.conf and Xorg.0.log would also be useful. Also check dmesg for errors.
    And see if /etc/rc.d/dbus is marked executable.
    Last edited by fphillips (2009-05-12 18:27:41)

  • Help with systemd problems/reply to closed thread

    @Everyone; as the previopus topic was closed, I am opening a new one here, partly to reply to some things that was said to me in the previous thread/topic (and I do not like to leave people hanging), but mainly to try and get some help with my systemd config (that I was not able to find help with in the wiki or manpages).
    @czubek; eww, that sounds rather similiar to some other operating systems I've heard of (not just, but obviously including, windows)... For me, subjectively, that is not very attractive, as being able to have a single application do a single thing, and then mixing and matching as I personally see fit is a great thing.
    @tomegun: I can indeed see your point, but if I made direct quotes on all the things I reply too, my posts would reach biblical proportions.
    Mmm-hmm, I do indeed know of "the Arch Way"; however, the system that you expose can be of varying complexity as well, and I found that the system that was presented to me by way of Sysvinit/initscripts was a way simpler system than that presented to me by systemd.
    Indeed, and I do like that; I enjoy knowing how my system works and learning more about it; however, the truth is that reading manpages and the wiki isn't always enough. And I use the numbers instead of letters in certain places as a jest, please, do not get offended by that; if you have to, get offended by my opinions.
    Ah, I have now scanned the wiki, the manpages, and have already faced problems. While part of me is saddened by this fact (as I was hoping for a smooth transition to systemd), part of me is glad that I can at least prove that everything isn't quite as simple as some people would make it out to be. More on this later in this post, as I do need help with the problems I have faced.
    And I wouldn't say that the new and old way are equally trivial, as I immediatley faced problems with "the new way". More on this later.
    Ok, I find that if the debate is polarized, then there is nothing wrong with describing it as such. I spell what I see.
    Oh my... Ignored as a matter of principle? I would say that that is an excellent way to stagnate; by that logic, moviemakers, gamemakers etcetera should ignore any and all criticism they recieve, as the critics are not contributing.... Wouldn't that lead to a complete halt in development? Isn't criticism (so long as it is constructive, obviously) a key component of (media/software) evolution?
    Ah, I see, then I  misunderstood the current state of the install media
    "Some adjustements"... Well, I guess we'll have to see how that goes, then. Hopefully it'll be smooth.
    @Everyone; Awebb possesses stunning accuracy as far as his observations go.
    @zb3; My point exactly.
    @tomegun; I believe you to be wrong; complaining (but not whining) is the first step towards improvement, as I think that I and zb3 has shown.
    Further, your last point (where you talk about "deep understanding of Y" and whatnot) is basically saying that only devs and programmers can contribute, so zb3's observation would be correct.
    Also, making suggestions is part of constructive criticism; you can do that even if you can't code, e.g. by saying "X works badly because it makes Y crash; couldn't we replace X with something akin to Z?". This is a valid point even if you have no intricate understanding of X, Y or Z, and if it is impossible to replace X for one reason or the other, it's not hard to reply with "Replacing X is impossible because of reason Q", and then see if someone can solve reason Q etcetera.
    zb3's example is obviously helping; for one, it would allow people to know taht they can't boot with systemd in certain cases, or that installing/runing systemd can break their system. I would consider that rather important information.
    @Everyone; Now then, to see if I can (or rather, if I can get help to) shed some light on some problems I've been having.
    My transition to systemd went pretty smooth (besides the fact that I couldn't use 'systemctl' to set anything, and neither duckduckgo nor any posts in the forums could help me (the error I continously got was "Failed to issue method call: Launch helper exited with unknown return code 1") and that there are no manpages/tips on how to configure the files for "localtime" and "adjtime", which would've been good considering some syntax have changed) to about halfway through, to the point where I was supposed to start using systemd for my daemons.
    Now then, to the main problem; first, I tried running
    "systemctl enable syslog-ng.service"
    and got the following message;
    "ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/syslog.service'
    ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/multi-user.target.wants/syslog-ng.service'"
    Since it doesn't exclusively say that something went wrong (at least as far as I can understand), I pondered the message a bit, but moved on to try and start dbus by issuing
    "systemctl enable dbus.service",
    to which I got the reply
    "The unit files have no [Install] section. They are not meant to be enabled using systemctl."
    This I can only assume is an error message of some sort, especially seeing as it says "not meant to be enabled using systemctl", but the wiki rather explicitly states that that is what I am supposed to do.
    I dare not move on (or attempt to start other daemons) without further advice, as I fear I might break my system. Any ideas as to how to solve this would be greatly appreciated.

    tcmdvm wrote:
    The message;
    "ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/syslog.service'
    ln -s '/usr/lib/systemd/system/syslog-ng.service' '/etc/systemd/system/multi-user.target.wants/syslog-ng.service'"
    indicates that running "systemctl enable syslog.service" is now enabled.
    If you try running sytemtctl enable <whatever>.service and get
    "The unit files have no [Install] section. They are not meant to be enabled using systemctl." means there is no <whatever>.service file available to enable.
    The dbus.service as far as I know is already enabled when installing systemd and doesn't require any action.
    Ah, right, systemd is chatty (I'm of the old skool; if nothing is/goes wrong, a program should keep quiet).
    Oh ok, then I should dare more on.
    ZekeSulastin wrote:To be a bit more precise, it means the service is there but it's only used as a dependency for something else; the [Install] section of the file is what tells systemctl where to link it and such.  Also, where exactly in the wiki were you told explicitly to 'systemctl enable dbus.service'?  I can easily point you to the sections in both installation guides that tell you how to set things like /etc/localtime et. al (also `man 7 archlinux`), but not the one that said to manually enable dbus.
    Ah, I see; and well, I was told right here, going from the top, to "Enable Daemons formerly listed in rc.conf [...] For a translation of the daemons from /etc/rc.conf to systemd services, see: List of Daemons and Services.", and, using the list, dbus is mentioned there, as you can see. Since I started from the top, I did not know that you didn't need to enable that service. Perhaps it could be added to the descriptions of the relevant services in the Wiki which ones are autostarted?
    ZekeSulastin wrote:Lastly, I don't think trying to continue conversations from a closed thread is a very good idea, let alone doing it in a giant undivided wall of text that makes it quite difficult to pick out much any single topic.
    Meh, I directly refer to the relevant people, they can easily see their own old posts in the previous thread, etcetera... I think te ones who have something to say will be able to find my replies to their previous statements (or so I hope). For now, as everyone can see, I quote stuff (but man might I make some huge posts if I ever post again in the future, if I quote what I reply to).
    fsckd wrote:This is not really a technical support subforum. Moving from Arch Discussion to Newbie Corner.
    Ah ok, thanks (or perhaps a cautious thanks? Moving it to "newbie corner" might, after all, be a subtle insult...).
    tomegun wrote:It is not really possible to follow your message as you don't quote what you are replying to. Moreover, as the thread was closed I think that means we should stop the discussion ;-)
    Hmm, I think it means cop-out for lack or proper arguments/responses... But ok, I'll let it slide, for now (mainly as I can't do much else).
    tomegun wrote:You are not meant to enable dbus.service as it is enabled unconditionally. To check the enabled/disabled state of your services try "systemctl list-unit-files". "static" means that you are not supposed to enabled/disable it.
    Ah ok, thank you. Now, having abandoned all hope, I'll start configuring again and see how it goes... May the void protect me. If I die, grieve not for me, but remember me in the fight against hard-to-configure applications.
    (edit/addon)
    Actually, what am I supposed to do with "hwclock"? the List of Daemons only says that I shouldn't run that in tandem with ntpd, but I'm not running ntpd, so... How do I get hwclock with systemd?
    Edited for additional question.
    Last edited by incassum (2012-11-07 08:44:42)

  • [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)

  • Getting sasc-ng to work properly with systemd service files [SOLVED]

    This thread is intended for getting the following AUR packages to work with each other with systemd service scripts:
    https://aur.archlinux.org/packages/open-sasc-ng-dkms/
    https://aur.archlinux.org/packages/open-sasc-ng/
    https://aur.archlinux.org/packages/oscam-svn/   (this is a related package as it must properly execute prior to sasc-ng)
    So my server is now on a fresh Arch install with systemd. All is well (& very fast) except I cannot get sasc-ng to function with systemd service init files. Prior to systemd the system worked fine with the rc initscripts & was very stable with the following setup:
    rc.local
    /etc/rc.d/oscam start
    sleep 15
    /etc/rc.d/sasc-ng start
    sleep 4
    /etc/rc.d/mythbackend start
    /etc/conf.d/sasc-ng.conf
    SASCNG_ARGS="-j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget"
    DVBLOOPBACK_ARGS="num_adapters=3"
    LOGDIR="/home/mythtv/logs/"
    CAMDIR="/etc/camdir"
    /etc/camdir/cardclient.conf
    camd35:localhost:15050:1/0000/0000:mythtv:mythtv
    I'll leave out the oscam stuff as that loads fine and doesn't appear to be a part of the problem
    I've tried this with the systemd service file that comes with the open-sasc-ng-dkms package and when it was not sucessful I tried a bunch of variants including using "Type=simple" ect. "Type=Forked" seems to be only option that actually tries to start the processes. I also "hardcoded" the service files for the 2 sasc-ng components to find a few issues with the EnvironmentFile variables. The log variable has been removed for now as this seems to cause a fatal error but the rest of the variables load fine now. I also tested spliting up the DVB loopback module from the sasc-ng binary but this also gives similar results as the following script stands now. Running them manually with systemctl start commands doesn't make a difference but that is not surprising. The service file I'm fiddling with now which I feel has the best potential become working is:
    sasc-ng.service
    [Unit]
    Description=Sasc-ng
    After=oscam.service
    [Service]
    Type=forking
    EnvironmentFile=/etc/conf.d/sasc-ng
    ExecStartPre=/sbin/modprobe dvbloopback $DVBLOOPBACK_ARGS
    TimeoutSec=2
    ExecStart=/usr/sbin/sasc-ng -D $SASCNG_ARGS --cam-dir=$CAMDIR
    TimeoutSec=4
    [Install]
    WantedBy=multi-user.target
    Mythbackend always runs fine (even without DTV via sasc-ng) with the following mythbackend.service:
    [Unit]
    Description=MythTV_backend
    After=sasc-ng.service
    [Service]
    Type=simple
    Environment=MYTHCONFDIR=/etc/conf.d/mythbackend
    Environment=HOME=/usr/share/mythtv
    User=mythtv
    ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv
    [Install]
    WantedBy=multi-user.target
    oscam.service taken mostly from AUR package also seems fine. I added the TimeoutSec=15 to give time for oscam to load the SC and client protocol before moving on or else sasc-ng fails
    Unit]
    Description=An Open Source Conditional Access Module software
    After=network.target
    [Service]
    Type=forking
    EnvironmentFile=/etc/conf.d/oscam
    ExecStart=/usr/bin/oscam $OSCAM_ARGS
    TimeoutSec=15
    [Install]
    WantedBy=multi-user.target
    Below is the output of the systemctl status commands. Despite the noise in the sasc-ng binary status, it is the loopback module that is " inactive (dead)" and there are no virtual DVB devices being created:
    [mythtv@server ~]$ sudo systemctl status oscam.service
    oscam.service - An Open Source Conditional Access Module software
    Loaded: loaded (/usr/lib/systemd/system/oscam.service; enabled)
    Active: active (running) since Tue, 2012-11-27 21:10:17 CET; 1min 7s ago
    Process: 338 ExecStart=/usr/bin/oscam $OSCAM_ARGS (code=exited, status=0/SUCCESS)
    Main PID: 377 (oscam)
    CGroup: name=systemd:/system/oscam.service
    ├ 377 /usr/bin/oscam -b -c /etc/oscam
    └ 378 /usr/bin/oscam -b -c /etc/oscam
    Nov 27 21:10:17 server systemd[1]: Started An Open Source Conditional Acces...e.
    [mythtv@server ~]$ sudo systemctl status loopback.service
    loopback.service - Sasc-ng DVB Loopback Module
    Loaded: loaded (/etc/systemd/system/loopback.service; enabled)
    Active: inactive (dead) since Tue, 2012-11-27 21:10:28 CET; 1min 27s ago
    Process: 907 ExecStart=/sbin/modprobe dvbloopback num_adapters=3 (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/loopback.service
    Nov 27 21:10:28 server systemd[1]: Started Sasc-ng DVB Loopback Module.
    [mythtv@server ~]$ sudo systemctl status sasc-ng.service
    sasc-ng.service - Sasc-ng
    Loaded: loaded (/etc/systemd/system/sasc-ng.service; enabled)
    Active: failed (Result: exit-code) since Tue, 2012-11-27 21:10:47 CET; 1min 45s ago
    Process: 913 ExecStart=/usr/sbin/sasc-ng -D -j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget --cam-dir=/etc/camdir -l /home/mythtv/logs/sasc-ng.log (code=exited, status=0/SUCCESS)
    Main PID: 921 (code=exited, status=255)
    CGroup: name=systemd:/system/sasc-ng.service
    Nov 27 21:10:39 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.info] loading cardclien...nf
    Nov 27 21:10:42 server sasc-ng[921]: [1062] Netwatcher thread started (pid=...6)
    Nov 27 21:10:42 server sasc-ng[921]: [921] [general.error] no keys loaded f...m!
    Nov 27 21:10:46 server sasc-ng[921]: [1098] SC housekeeper thread started (...2)
    Nov 27 21:10:47 server sasc-ng[921]: [1062] Netwatcher thread ended (pid=92...6)
    Nov 27 21:10:47 server systemd[1]: sasc-ng.service: main process exited, co.../a
    Nov 27 21:10:47 server systemd[1]: Unit sasc-ng.service entered failed state
    [mythtv@server ~]$ sudo systemctl status sasc-ng.service
    sasc-ng.service - Sasc-ng
    Loaded: loaded (/etc/systemd/system/sasc-ng.service; enabled)
    Active: failed (Result: exit-code) since Tue, 2012-11-27 21:10:47 CET; 2min 9s ago
    Process: 913 ExecStart=/usr/sbin/sasc-ng -D -j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget --cam-dir=/etc/camdir -l /home/mythtv/logs/sasc-ng.log (code=exited, status=0/SUCCESS)
    Main PID: 921 (code=exited, status=255)
    CGroup: name=systemd:/system/sasc-ng.service
    Nov 27 21:10:39 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/smartcard.conf: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/cardslot.conf: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/SoftCam.Key: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.info] loading cardclient config from /etc/camdir/cardclient.conf
    Nov 27 21:10:42 server sasc-ng[921]: [1062] Netwatcher thread started (pid=921, tid=140074379712256)
    Nov 27 21:10:42 server sasc-ng[921]: [921] [general.error] no keys loaded for softcam!
    Nov 27 21:10:46 server sasc-ng[921]: [1098] SC housekeeper thread started (pid=921, tid=140074371319552)
    Nov 27 21:10:47 server sasc-ng[921]: [1062] Netwatcher thread ended (pid=921, tid=140074379712256)
    Nov 27 21:10:47 server systemd[1]: sasc-ng.service: main process exited, code=exited, status=255/n/a
    Nov 27 21:10:47 server systemd[1]: Unit sasc-ng.service entered failed state
    [mythtv@server ~]$
    Any ideas?
    Last edited by wdirksen (2012-12-10 19:54:43)

    After some head scratching it seems to be all good now. Considering there have been no replies to this I've come to wonder if I might be the only one with this issue. I could get it working somewhat using service files but never ideal, ex. sasc-ng only using a few of the entitlements from oscam because it started too quick etc. Anyway this might help a few and I'm hoping the linux savvy who find what I'm writing here painfully newbie like or flawed will reply and educate me a bit if what's provided here needs some sharpening up:
    1) Systemd was confusing the sasc-ng binary shorthand arguments with Linux init arguments and a few were misinterpreted if they were not nested into the environment specifiers. So the -l (log) was causing problems and -b (buffer) wasn't loading. To be safe I'm using only the sasc-ng longhand specifiers from now on (two "--" and more verbose) so that they can never be confused even if safely nested in an environment parameter. That means that /etc/conf.d/sasc-ng will also need to be changed to reflect this. I also decided to simplify the LOGFILE parameter to include the whole argument syntax.
    2) Oscam.service needs to be initiated with oneshot and RemainAfterExit=yes to make sure the delay (15 seconds in my config) gets counted out before sasc-ng initiates.
    [EDIT 12/12/2012: Initially I had a second TimeoutSec=2 after ExecStart in sasc-ng.service but this had no function. Turns out that it almost always does work without this delay but not always with my setup. Adding TimeoutSec=2 to mythbackend.service prior to ExecStart command does function and makes things init more consistant]
    sasc-ng.service
    [Unit]
    Description=Sasc-ng
    After=oscam.service
    [Service]
    Type=simple
    EnvironmentFile=/etc/conf.d/sasc-ng
    ExecStartPre=/sbin/modprobe dvbloopback $DVBLOOPBACK_ARGS
    TimeoutSec=2
    ExecStart=/usr/sbin/sasc-ng $SASCNG_ARGS --cam-dir $CAMDIR --log $LOGFILE
    [Install]
    WantedBy=multi-user.target
    /etc/conf.d/sasc-ng
    SASCNG_ARGS="--join 0:3 --join 1:4 --join 2:5 --buffer 16M --sid-allpid --sid-nocache --cam-budget"
    DVBLOOPBACK_ARGS="num_adapters=3"
    LOGFILE="/home/mythtv/logs/sasc-ng.log"
    CAMDIR="/etc/camdir"
    oscam.service
    [Unit]
    Description=An Open Source Conditional Access Module software
    After=network.target
    [Service]
    Type=oneshot
    EnvironmentFile=/etc/conf.d/oscam
    ExecStart=/usr/bin/oscam $OSCAM_ARGS
    TimeoutSec=15
    RemainAfterExit=yes
    [Install]
    WantedBy=multi-user.target
    mythbackend.service
    [Unit]
    Description=MythTV_backend
    After=sasc-ng.service
    [Service]
    Type=simple
    TimeoutSec=2
    Environment=MYTHCONFDIR=/etc/conf.d/mythbackend
    Environment=HOME=/usr/share/mythtv
    User=mythtv
    ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv
    [Install]
    WantedBy=multi-user.target
    I will make the related changes to the open-sasc-ng AUR package which I currently maintain
    Last edited by wdirksen (2012-12-23 14:40:43)

  • [Solved] postgresql with systemd

    Hello Guys,
    I'm having problems starting the postgres with systemd.
    Following errors:
    Running systemctl start postgresql
    k@archK ~ % sudo systemctl start postgresql
    Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details.
    1 k@archK ~ %
    Running systemctl status postgresql.service got the message below:
    k@archK ~ % systemctl status postgresql.service
    postgresql.service - PostgreSQL database server
    Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
    Active: failed (Result: exit-code) since Sáb, 2012-12-29 19:09:19 BRT; 1min 19s ago
    Process: 1746 ExecStart=/usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 (code=exited, status=1/FAILURE)
    Process: 1741 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/postgresql.service
    3 k@archK ~ %
    and journalctl -xn this:
    k@archK ~ % sudo journalctl -xn
    [sudo] password for k:
    -- Logs begin at Sáb, 2012-12-29 03:47:42 BRT, end at Sáb, 2012-12-29 19:11:49 BRT. --
    Dez 29 19:09:19 archK systemd[1]: postgresql.service: control process exited, code=exited status=1
    Dez 29 19:09:19 archK systemd[1]: Failed to start PostgreSQL database server.
    -- Subject: Unit postgresql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
    -- Unit postgresql.service has failed.
    -- The result is failed.
    Dez 29 19:09:19 archK systemd[1]: Unit postgresql.service entered failed state
    Dez 29 19:09:19 archK sudo[1738]: pam_unix(sudo:session): session closed for user root
    Dez 29 19:11:27 archK udisks-daemon[430]: **** Refreshing ATA SMART data for /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda
    Dez 29 19:11:27 archK udisks-daemon[430]: helper(pid 1781): launched job udisks-helper-ata-smart-collect on /dev/sda
    Dez 29 19:11:28 archK udisks-daemon[430]: helper(pid 1781): completed with exit code 0
    Dez 29 19:11:28 archK udisks-daemon[430]: **** EMITTING CHANGED for /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda
    Dez 29 19:11:49 archK sudo[1786]: k : TTY=pts/0 ; PWD=/home/k ; USER=root ; COMMAND=/usr/bin/journalctl -xn
    Dez 29 19:11:49 archK sudo[1786]: pam_unix(sudo:session): session opened for user root by k(uid=0)
    Here is the postgresql.service
    [Unit]
    Description=PostgreSQL database server
    After=network.target
    [Service]
    Type=forking
    TimeoutSec=120
    User=postgres
    Group=postgres
    Environment=PGROOT=/var/lib/postgres
    SyslogIdentifier=postgres
    PIDFile=/var/lib/postgres/data/postmaster.pid
    ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
    ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
    ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
    ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
    # Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
    # killing Postgres, so adjust it downward
    OOMScoreAdjust=-200
    [Install]
    WantedBy=multi-user.target
    and /etc/conf.d/postgresql
    ## Parameters to be passed to postgresql
    ## Default data directory location
    PGROOT="/var/lib/postgres"
    ## Passed to initdb if necessary
    INITOPTS="--locale en_US.UTF-8"
    ## Default log file location
    #PGLOG="/var/log/postgresql.log"
    ## Additional options to pass via pg_ctl's '-o' option
    #PGOPTS=""
    Does anyone have any idea how to fix this?
    Thanks.
    Last edited by kleitonkk (2013-01-03 23:51:41)

    Sorry for the delay, was traveling and just returned yesterday.
    lothar_m was followed as described in the post, since removed the packages twice and did the install again but the same error.
    [root@archK conf.d]# systemctl start postgresql
    Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details.
    [root@archK conf.d]#
    systemctl status postgresql.service
    ➜ ~ systemctl status postgresql.service
    postgresql.service - PostgreSQL database server
    Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled)
    Active: failed (Result: exit-code) since Thu, 2013-01-03 18:14:43 BRT; 9min ago
    Process: 10897 ExecStart=/usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 (code=exited, status=1/FAILURE)
    Process: 10892 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/postgresql.service
    ➜ ~
    [root@archK conf.d]# journalctl -xn
    -- Logs begin at Wed, 2013-01-02 16:50:57 BRT, end at Thu, 2013-01-03 18:34:41 BRT. --
    Jan 03 18:25:28 archK su[11082]: pam_unix(su:session): session opened for user root by k(uid=1000)
    Jan 03 18:34:36 archK systemd[1]: Starting PostgreSQL database server...
    -- Subject: Unit postgresql.service has begun with start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/7d4958e842da4a758f6c1cdc7b36dcc5
    -- Unit postgresql.service has begun starting up.
    Jan 03 18:34:36 archK postgres[11127]: LOG: could not translate host name "localhost", service "5432" to address: Name or service not known
    Jan 03 18:34:36 archK postgres[11127]: WARNING: could not create listen socket for "localhost"
    Jan 03 18:34:36 archK postgres[11127]: FATAL: could not create any TCP/IP sockets
    Jan 03 18:34:41 archK postgres[11127]: pg_ctl: could not start server
    Jan 03 18:34:41 archK postgres[11127]: Examine the log output.
    Jan 03 18:34:41 archK systemd[1]: postgresql.service: control process exited, code=exited status=1
    Jan 03 18:34:41 archK systemd[1]: Failed to start PostgreSQL database server.
    -- Subject: Unit postgresql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
    -- Unit postgresql.service has failed.
    -- The result is failed.
    Jan 03 18:34:41 archK systemd[1]: Unit postgresql.service entered failed state
    /usr/lib/systemd/system/postgresql.service
    [Unit]
    Description=PostgreSQL database server
    After=network.target
    [Service]
    Type=forking
    TimeoutSec=120
    User=postgres
    Group=postgres
    Environment=PGROOT=/var/lib/postgres
    SyslogIdentifier=postgres
    PIDFile=/var/lib/postgres/data/postmaster.pid
    ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
    ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
    ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
    ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
    # Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
    # killing Postgres, so adjust it downward
    OOMScoreAdjust=-200
    [Install]
    WantedBy=multi-user.target
    ➜ ~ pacman -Q |grep postgres
    postgresql 9.2.2-2
    postgresql-libs 9.2.2-2
    ➜ ~
    /etc/conf.d
    ## Parameters to be passed to postgresql
    ## Default data directory location
    PGROOT="/var/lib/postgres"
    ## Passed to initdb if necessary
    INITOPTS="--locale en_US.UTF-8"
    ## Default log file location
    #PGLOG="/var/log/postgresql.log"
    ## Additional options to pass via pg_ctl's '-o' option
    #PGOPTS=""
    /usr/lib/systemd/system/postgresql.service
    [Unit]
    Description=PostgreSQL database server
    After=network.target
    [Service]
    Type=forking
    TimeoutSec=120
    User=postgres
    Group=postgres
    Environment=PGROOT=/var/lib/postgres
    SyslogIdentifier=postgres
    PIDFile=/var/lib/postgres/data/postmaster.pid
    ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
    ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
    ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
    ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
    # Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
    # killing Postgres, so adjust it downward
    OOMScoreAdjust=-200
    [Install]
    WantedBy=multi-user.target
    I'm still looking for how to solve.
    Thank you.

  • [Solved] Automating btrfs scrub with systemd

    I have a single disk laptop (no RAID) and would like to have btrfs scrub run automatically on some interval and to be automatically emailed if any errors are found.  (My data is backed up online and I can attempt a manual fix.)  I'm trying to set this up with systemd and the btrfs tools.  Here's what I figure I need:
    A systemd service to run btrfs scrub on my entire filesystem.
    A systemd timer to schedule this job weekly.
    systemd services to pause and resume a running btrfs scrub when the machine suspends and wakes up.
    A script to run btrfs status when the previous service has finished, parse the output for the number of errors, and email me if the number is greater than 0.
    A systemd service to run that script when the scrub service has completed.
    What I have so far is below.  I'm sure there are problems with it all, and I'm especially uncertain about #5, since I don't know if the After attribute of one service waits until another has completed or just started.  If anyone could take a look and give me some pointers I'd appreciate it very much.  (The python script is a hack but I'm more concerned with the systemd at the moment, unless you see obvious problems or improvements you'd like to suggest.)
    Attempt at 1 and 2:
    /etc/systemd/system/btrfs_scrub.service
    [Unit]
    Description=Run btrfs scrub on filesystem
    [Service]
    Type=forking
    ExecStart=btrfs scrub start /home
    /etc/systemd/system/btrfs_scrub.timer
    [Unit]
    Description=Weekly btrfs scrub
    [Timer]
    OnCalendar=weekly
    Persistent=true
    [Install]
    WantedBy=timers.target
    Attempt at 3:
    /etc/systemd/system/btrfs_cancel.service
    [Unit]
    Description=Pause a running btrfs scrub on suspend
    Before=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub cancel /home
    [Install]
    WantedBy=suspend.target
    /etc/systemd/system/btrfs_resume.service
    [Unit]
    Description=Resume a paused btrfs scrub after suspend
    After=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub resume /home
    [Install]
    WantedBy=suspend.target
    Attempt at 4:
    /home/username/Code/Scripts/btrfs_results.py
    #Runs btrfs scrub and looks for an indication of errors found, upon
    #which an email is sent.
    import subprocess
    import smtplib
    from email.mime.text import MIMEText
    def email_alert():
    text = "btrfs scrub found errors"
    addr = 'myemail@address'
    username = 'myusername'
    password = 'mypassword'
    msg = MIMEText(text)
    msg['Subject'] = 'btrfs errors'
    msg['From'] = addr
    msg['To'] = addr
    server = smtplib.SMTP('smtp.gmail.com', '587')
    server.starttls()
    server.login(username,password)
    server.sendmail(addr, addr, msg.as_string())
    server.quit()
    print('email sent')
    def main():
    cmd = ['btrfs', 'scrub', 'status', '/home']
    output = subprocess.check_output(cmd)
    output_str = output.decode("utf-8")
    output_words = output_str.split(' ')
    for w in range(0, len(output_words)):
    if output_words[w].find('error') > -1:
    if int(output_words[w - 1]) > 0:
    email_alert()
    main()
    Attempt at 5:
    /etc/systemd/system/btrfs_results.service
    [Unit]
    Description=Parse output from btrfs scrub
    Requires=btrfs_scrub.service
    After=btrfs_scrub.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/python /home/username/Code/Scripts/btrfs_results.py
    [Install]
    WantedBy=multi-user.target
    Last edited by 0112358 (2014-09-16 01:26:21)

    0112358 wrote:I have a single disk laptop (no RAID) and would like to have btrfs scrub run automatically on some interval and to be automatically emailed if any errors are found.  (My data is backed up online and I can attempt a manual fix.)  I'm trying to set this up with systemd and the btrfs tools.  Here's what I figure I need:
    0112358 wrote:
    A systemd service to run btrfs scrub on my entire filesystem.
    A systemd timer to schedule this job weekly.
    Should not be hard.
    0112358 wrote:systemd services to pause and resume a running btrfs scrub when the machine suspends and wakes up.
    This happens automatically with s2disk. Am I missing something?
    0112358 wrote:A script to run btrfs status when the previous service has finished, parse the output for the number of errors, and email me if the number is greater than 0.
    You might want to integrate that in the main btrfs scrub script, just after scrub is completed you will run this. Right?
    0112358 wrote:A systemd service to run that script when the scrub service has completed.
    0112358 wrote: What I have so far is below.  I'm sure there are problems with it all, and I'm especially uncertain about #5, since I don't know if the After attribute of one service waits until another has completed or just started.  If anyone could take a look and give me some pointers I'd appreciate it very much.  (The python script is a hack but I'm more concerned with the systemd at the moment, unless you see obvious problems or improvements you'd like to suggest.)
    0112358 wrote:
    Attempt at 1 and 2:
    /etc/systemd/system/btrfs_scrub.service
    [Unit]
    Description=Run btrfs scrub on filesystem
    [Service]
    Type=forking
    ExecStart=btrfs scrub start /home
    /etc/systemd/system/btrfs_scrub.timer
    [Unit]
    Description=Weekly btrfs scrub
    [Timer]
    OnCalendar=weekly
    Persistent=true
    [Install]
    WantedBy=timers.target
    Yes, why not wrap this in some sort of main bash (or python) script.
    0112358 wrote:
    Attempt at 3:
    /etc/systemd/system/btrfs_cancel.service
    [Unit]
    Description=Pause a running btrfs scrub on suspend
    Before=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub cancel /home
    [Install]
    WantedBy=suspend.target
    /etc/systemd/system/btrfs_resume.service
    [Unit]
    Description=Resume a paused btrfs scrub after suspend
    After=suspend.target
    [Service]
    Type=oneshot
    ExecStart=btrfs scrub resume /home
    [Install]
    WantedBy=suspend.target
    Why not do nothing at all? Just let the fs continue after resume. Or is s2disk cancelling this process?
    0112358 wrote:
    Attempt at 4:
    /home/username/Code/Scripts/btrfs_results.py
    #Runs btrfs scrub and looks for an indication of errors found, upon
    #which an email is sent.
    import subprocess
    import smtplib
    from email.mime.text import MIMEText
    def email_alert():
    text = "btrfs scrub found errors"
    addr = 'myemail@address'
    username = 'myusername'
    password = 'mypassword'
    msg = MIMEText(text)
    msg['Subject'] = 'btrfs errors'
    msg['From'] = addr
    msg['To'] = addr
    server = smtplib.SMTP('smtp.gmail.com', '587')
    server.starttls()
    server.login(username,password)
    server.sendmail(addr, addr, msg.as_string())
    server.quit()
    print('email sent')
    def main():
    cmd = ['btrfs', 'scrub', 'status', '/home']
    output = subprocess.check_output(cmd)
    output_str = output.decode("utf-8")
    output_words = output_str.split(' ')
    for w in range(0, len(output_words)):
    if output_words[w].find('error') > -1:
    if int(output_words[w - 1]) > 0:
    email_alert()
    main()
    Ok
    0112358 wrote:
    Attempt at 5:
    /etc/systemd/system/btrfs_results.service
    [Unit]
    Description=Parse output from btrfs scrub
    Requires=btrfs_scrub.service
    After=btrfs_scrub.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/python /home/username/Code/Scripts/btrfs_results.py
    [Install]
    WantedBy=multi-user.target
    Yeah, why not wrap 1,2,4 and 5 into one script/service. Why the fine granularity?

  • Completely replacing consolekit with systemd?

    I noticed on the systemd wiki it says its now possible to replace the now un-maintained consolekit's functionality with systemd, but I had some concerns before trying it, and was wondering if anyone has tried this yet.
    1. I noticed the polkit-systemd package in the aur is marked out of date since june. Should I just build it myself with the abs?
    2. GDM and Gnome-Session still seem to require consolekit to be installed, if I have a systemd enabled polkit will they still try and use consolekit, or do they just support both at runtime?

    bwat47 wrote:
    installed tomegun's polkit and removed consolekit using Rdd as suggested by Runiq. Seems to be working fine, I can mount removable drivers, smb shares etc.. in nautilus and gdm works fine. However after doing this for some strange reason the gnome-shell networkmanager applet is showing the wired connection icon (computer screen) when I am connected to wireless instead of the wireless bars (otherwise the applet is working totally fine). Not sure if removing consolekit caused it or the polkit package, not a big deal though.
    EDIT: I also can't access the advanced networking options in the gnome network settings now, its greyed out. Perhaps gnome still has some bugs with systemd only setup.
    A clarification: I just recompiled polkit with ABS (version 0.105 vs. tomegun's 0.107). At first I also recompiled gdm and gnome-session, found that everything worked, and worked my way back to a minimal working version. I eventually ended up using the recompiled gdm and gnome-session packages, though; but that was mainly to get pacman to shut up about the unresolved consolekit dependency.
    ANOKNUSA wrote:still can't mount anything.  I'm not sure where to start debugging
    How do you mount things? I'm using a custom Python script that runs udisks over dbus in the background, so I need a working udisks.service and a working dbus session bus (check for DBUS_SESSION_BUS_ADDRESS and, for good measure, see that loginctl shows an active session for your user).
    Last edited by Runiq (2012-09-01 16:23:29)

  • Start rtorrent on boot?

    Hello,
    I'm trying to make a torrent box. So far I've installed rtorrent and wtorrent (web front-end). I haven't been able to get rtorrent to download yet, but that's because I haven't really configured it.
    Is there anyway to start rtorrent as a daemon upon boot? The way it's set up now, after the server boots, I have to manually log into my user and start it with `rtorrent`. I'd like for rtorrent to start automatically. Also, is there an global config file for rtorrent? As far as I know, it takes it's configuration from ~/.rtorrent.rc, which is user specific (which will get in the way if the rtorrent starts as a daemon, ie: non-user)
    Thanks

    I'd add
    su username -c "screen rtorrent"
    to rc.local.
    -edit-
    Found this: http://bbs.archlinux.org/viewtopic.php?id=53395
    Last edited by lucke (2009-05-23 23:15:08)

  • Systemd-cron: minimal cron replacement with systemd

    systemd-cron
    systemd-cron is a set of systemd unit files that take advantage of systemd's timer units and calendar events to execute scripts in the standard cron.hourly, cron.daily, cron.weekly, and cron.monthly directories. For simple setups where this is all you need, this allows you to not have to run a cron daemon. Of course this also means it is not a drop-in replacement for a traditional cron daemon and you will not get support for:
    crontab files
    per-user jobs
    executing missed jobs
    emailing job output
    et cetera
    To use, stop and uninstall any existing cron daemon and install the AUR package. Then as root run:
    # systemctl enable cron.target
    # systemctl start cron.target
    Please note the .target suffix.
    More details are available with:
    $ man systemd.cron
    I have been using it successfully on my servers for a week now with no troubles.

    nbvcxz wrote:Haven't tested jet but really nice idea - thumbs up. Any possibilities to make per user jobs in the future?
    That would probably be the next thing I do. As Morrad described above it should be pretty natural with systemd user sessions. After that probably crontab support using generators.

  • Gpg-agent with systemd

    Hey!
    I am a novice Arch user and I am having problems with the latest gpg distribution when used with systemd and ssh-support. Currently, I am using i3 with lightdm, and I am using systemd to start gpg-agent with ssh support. Specifically, I have the following gpg-agent.service file in my ${HOME}/.config/systemd/user/ directory:
    [Unit]
    Description=gpg-agent Daemon with SSH Support
    [Service]
    Type=forking
    ExecStart=/usr/bin/gpg-agent --quiet --daemon --enable-ssh-support
    Restart=on-success
    [Install]
    WantedBy=default.target
    which is expected to restart when exited properly and/or due to a signal. When I enable and start the service with systemctl --user prefix, it works as it is supposed to be. I have the following gpg-agent.conf file:
    default-cache-ttl 600
    default-cache-ttl-ssh 3600
    max-cache-ttl 7200
    max-cache-ttl-ssh 7200
    enforce-passphrase-constraints
    min-passphrase-len 10
    min-passphrase-nonalpha 4
    max-passphrase-days 180
    pinentry-program /usr/bin/pinentry-curses
    and the following excerpt in my .zshrc:
    # GPG configuration
    # Check for the gpg-agent socket, and set SSH_AUTH_SOCK and GPG_TTY
    # environment variables accordingly:
    if [[ -S "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export GPG_TTY=$(tty)
    if [[ ${SSH_AUTH_SOCK} != "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
    fi
    fi
    The problem is, everything is working properly except for one thing: "When I want to ssh to my server, I get an 'Agent admitted failure to sign using the key' error." I mean, the environment variables seem to be fine when I fire up a zsh session (terminal emulator) and/or everything seems ok when I issue systemctl --user status gpg-agent, but I cannot ssh to my server using my gpg-key. However, when I stop the systemd unit and just issue eval $(gpg-agent --quiet --daemon --enable-ssh-support) in a new terminal emulator, ssh works fine. In both of the aforementioned versions, when I issue gpg --clearsign some_file.txt command, I am asked in the terminal emulator for my password (I suppose in the so called curses pinentry program).
    I thank you in advance for your time, and appreciate any suggestions. Best,

    You might need to make a script to start it. Like "/usr/local/bin/gpg-agent-daemon.zsh"
    then in that file have:
    #!/usr/bin/zsh
    gpg-agent --quiet --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info"
    And do chmod +x
    And in your gpg-agent.service file:
    [Service]
    Type=forking
    ExecStart=gpg-agent-daemon.zsh
    <...>
    And then in $ZDOTDIR/.zprofile
    # GPG configuration
    # Check for the gpg-agent socket, and set SSH_AUTH_SOCK and GPG_TTY
    # environment variables accordingly:
    if [[ -S "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export GPG_TTY=$(tty)
    export GPG_TTY
    if [[ ${SSH_AUTH_SOCK} != "${HOME}/.gnupg/S.gpg-agent.ssh" ]]; then
    export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
    fi
    if [ -f "${HOME}/.gpg-agent-info" ]; then
    . "${HOME}/.gpg-agent-info"
    export GPG_AGENT_INFO
    fi
    fi

  • Mythtv with systemd problems [SOLVED]

    Anyone using mythtv with systemd?  I am using the following to get systemd to start mythbackend but it attempts to start before mysqld is fully ready and thus fails:
    $ cat /etc/systemd/system/mythbackend.service
    [Unit]
    Description=MythTV backend service
    After=network.target mysqld.service
    [Service]
    Type=simple
    Environment=MYTHCONFDIR=/etc/conf.d/mythbackend
    Environment=HOME=/usr/share/mythtv
    User=mythtv
    ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv
    [Install]
    WantedBy=multi-user.target
    Here is the status output... any advice?
    # systemctl status mythbackend.service
    mythbackend.service - MythTV backend service
    Loaded: loaded (/etc/systemd/system/mythbackend.service; enabled)
    Active: failed (Result: exit-code) since Thu, 10 May 2012 11:59:57 -0400; 2min 40s ago
    Process: 415 ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv/mythbackend.log (code=exited, status=130)
    CGroup: name=systemd:/system/mythbackend.service
    May 10 11:59:54 mars mythbackend[415]: 2012-05-10 11:59:54.273466 E Driver error was [1/2002]:
    May 10 11:59:54 mars mythbackend[415]: QMYSQL: Unable to connect
    May 10 11:59:54 mars mythbackend[415]: Database error was:
    May 10 11:59:54 mars mythbackend[415]: Can't connect to local MySQL server through socket '/var/ru... (2)
    May 10 11:59:56 mars mythbackend[415]: No UPnP backends found
    May 10 11:59:56 mars mythbackend[415]: Would you like to configure the database connection now? [no]
    May 10 11:59:56 mars mythbackend[415]: [console is not interactive, using default 'no']
    May 10 11:59:56 mars mythbackend[415]: 2012-05-10 11:59:56.526065 I UPnPautoconf() - No UPnP back...ound
    May 10 11:59:56 mars mythbackend[415]: 2012-05-10 11:59:56.526080 A No UPnP backends found
    May 10 11:59:56 mars mythbackend[415]: 2012-05-10 11:59:56.526190 C Failed to init MythContext.
    Last edited by graysky (2012-05-11 20:17:34)

    Cool, 65kid.  Back on topic: http://rpm.pbone.net/index.php3/stat/4/ … 4.rpm.html
    $ cat ./usr/libexec/mysqld-wait-ready
    #!/bin/sh
    # This script waits for mysqld to be ready to accept connections
    # (which can be many seconds or even minutes after launch, if there's
    # a lot of crash-recovery work to do).
    # Running this as ExecStartPost is useful so that services declared as
    # "After mysqld" won't be started until the database is really ready.
    # Service file passes us the daemon's PID
    daemon_pid="$1"
    # extract value of a MySQL option from config files
    # Usage: get_mysql_option SECTION VARNAME DEFAULT
    # result is returned in $result
    # We use my_print_defaults which prints all options from multiple files,
    # with the more specific ones later; hence take the last match.
    get_mysql_option(){
    result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
    if [ -z "$result" ]; then
    # not found, use default
    result="$3"
    fi
    # Defaults here had better match what mysqld_safe will default to
    get_mysql_option mysqld datadir "/var/lib/mysql"
    datadir="$result"
    get_mysql_option mysqld socket "$datadir/mysql.sock"
    socketfile="$result"
    # Wait for the server to come up or for the mysqld process to disappear
    ret=0
    while /bin/true; do
    RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
    mret=$?
    if [ $mret -eq 0 ]; then
    break
    fi
    # exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
    # anything else suggests a configuration error
    if [ $mret -ne 1 -a $mret -ne 11 ]; then
    ret=1
    break
    fi
    # "Access denied" also means the server is alive
    echo "$RESPONSE" | grep -q "Access denied for user" && break
    # Check process still exists
    if ! /bin/kill -0 $daemon_pid 2>/dev/null; then
    ret=1
    break
    fi
    sleep 1
    done
    WTF: /usr/bin/my_print_defaults
    Here is the Arch rc.d script... how to adapt this for systemd?
    stat_busy "Starting MySQL Server"
    [ ! -d /var/run/mysqld ] && install -d -g mysql -o mysql /var/run/mysqld &>/dev/null
    if [ -z "$(getPID)" ]; then
    /usr/bin/mysqld_safe --user=mysql &>/dev/null &
    if [ $? -gt 0 ]; then
    stat_fail
    exit 1
    else
    timeo=30
    while [ $timeo -gt 0 ]; do
    response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
    echo "$response" | grep -q "mysqld is alive" && break
    sleep 1
    let timeo=${timeo}-1
    done
    if [ $timeo -eq 0 ]; then
    stat_fail
    exit 1
    else
    echo $(getPID) > /var/run/mysqld/mysqld.pid
    add_daemon mysqld
    stat_done
    fi
    fi
    else
    stat_fail
    exit 1
    fi
    Last edited by graysky (2012-05-10 19:06:04)

Maybe you are looking for

  • Failed to Run Task Sequence (error ocurred while retrieving policy for the computer)

    Hi, all of sudden we're getting an issue with SCCM when attempting to deploy an image we get a Failed to Run Task Sequence. Used to work previously, now suddenly it isn't working for any. Full error: Failed to Run Task Sequence An Error occurred whil

  • Flex fields in default BPM view 11.1.1.3.0

    Hi I Jdeveloper 11.1.1.3.0 I have created a SOA composite with a BPEL flow containing a Human task. In this task I have added data fields (flex fields) which I'm able to show in the Oracle BPM worklist using the Adminstration menu option and adding t

  • Impossible to uptdate my 3120 classic

    Hello, One day, I updtated my 3120 classic without problems. Now that I'm trying to update it to version 10.0, it's impossible. The update begins, my phone goes in test mode for a few seconds then switch on automatically and NSU tells me that there i

  • How to turn off mouse (or touchpad) scrolling when running vim in an xterm?

    Just updated 13" macbook pro (mid-2010) from Snow Leopard (10.6.8) to Yosemite (10.10.1).  Previously, when running vim in an xterm, scrolling with the touchpad did nothing inside vim, it just scrolled the xterm history back so I could see what I had

  • Security update 2013-001 broke remote printing

    I installed the 2013-001 update on a MacPro (10.6.8) and printing through a shared printer on another Mac (iMac 20, 10.6.8) is no longer possible. The print job is stopped at the client's print queue with a "On Hold ((Authentication required)" status