[SOLVED] Trying to write HLDS systemd service file

Hey,
I want to write a systemd service file for my HLDS AUR package: https://aur.archlinux.org/packages/hlds/
My environment file looks like this:
HLDS_USER=root
HLDS_WORKINGDIR=/opt/hlds
HLDS_PARAMS="-game cstrike"
HLDS_LOGFILE=/var/log/hlds_cstrike
The service file like this:
After=network.target
[Service]
#EnvironmentFile=/etc/conf.d/hlds
#User=${HLDS_USER}
#WorkingDirectory=${HLDS_WORKINGDIR}
ExecStart=/opt/hlds/hlds_run -game cstrike
ExecStop=/bin/kill $MAINPID
[Install]
WantedBy=multi-user.target
But systemd fails to start the service:
hlds.service - Half-Life Dedicated Server
          Loaded: loaded (/usr/lib/systemd/system/hlds.service; disabled)
          Active: failed (Result: exit-code) since Thu, 2013-01-03 06:20:49 CET; 2s ago
         Process: 567 ExecStop=/bin/kill $MAINPID (code=exited, status=1/FAILURE)
         Process: 564 ExecStart=/opt/hlds/hlds_run -game cstrike (code=killed, signal=INT)
          CGroup: name=systemd:/system/hlds.service
Jan 03 06:20:49 playground systemd[1]: Starting Half-Life Dedicated Server...
Jan 03 06:20:49 playground systemd[1]: Started Half-Life Dedicated Server.
Jan 03 06:20:49 playground hlds_run[564]: Invalid game type 'cstrike' sepecified.
Jan 03 06:20:49 playground hlds_run[564]: Thu Jan  3 06:20:49 CET 2013: Server Failed
Jan 03 06:20:49 playground kill[567]: usage: kill [ -s signal | -p ] [ -a ] pid ...
Jan 03 06:20:49 playground kill[567]: kill -l [ signal ]
Jan 03 06:20:49 playground systemd[1]: Unit hlds.service entered failed state
Running
/opt/hlds/hlds_run -game cstrike
manually works quote well
Someone knows how to proceed? Thanks
Last edited by onny (2013-01-03 05:43:49)

Solved. It didn't recognized the workingdir correctly ...

Similar Messages

  • 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] systemd .service file for ruby rainbows server

    I am trying to create a systemd .service file for a ruby rainbows server.
    http://rainbows.rubyforge.org/
    does anybody have experience with a forking deamon under systemd?
    Mine immediatley terminates after starting.
    Last edited by wabi (2013-01-03 11:11:02)

    This is a .service file that will work:
    [Unit]
    Description=Redmine Rainbows Rails server
    [Service]
    Type=forking
    SyslogIdentifier=redmine
    User=http
    PIDFile=/var/www/redmine/tmp/pids/rainbows.pid
    WorkingDirectory=/var/www/redmine
    ExecStart=/usr/bin/bundle exec rainbows --host 127.0.0.1 --port 8001 --env production --daemonize --config-file /var/www/redmine/config/rainbows.rb
    ExecReload=/bin/kill -HUP $MAINPID
    ExecStop=/bin/kill -QUIT $MAINPID
    [Install]
    WantedBy=multi-user.target
    Last edited by wabi (2013-01-03 11:11:38)

  • [solved] systemd service files don't allow quotes

    Why is it not possible to use quotes in
    ExecStart=
    section of systemd service files?
    For example, I can't use service file like this
    [Unit]
    Description=Pacman mirrorlist update
    [Service]
    Type=oneshot
    ExecStart=wget -O /etc/pacman.d/mirrorlist.backup "https://www.archlinux.org/mirrorlist/?country=DE&country=NL&country=PL&protocol=http&ip_version=4" && cp /etc/pacman.d/mirrorlist.backup /etc/pacman.d/mirrorlist && reflector --verbose -l 50 -p http --sort rate --save /etc/pacman.d/mirrorlist
    because systemd will not run it because of presence of quotes:
    Feb 26 08:48:36 nanoBox systemd[1]: [/etc/systemd/system/reflector.service:7] Executable path is not absolute, ignoring: wget -O /etc/pacman.d/mirrorlist.backup "URL=http...
    Feb 26 08:48:36 nanoBox systemd[1]: reflector.service lacks both ExecStart= and ExecStop= setting. Refusing.
    I can remove quotes and then the service will run, but the URL parsed to the command will be cut in half, ie it will stop on the first "&" sign and only DE mirrors will be probed.
    Is there some way around it other than creating a separate executable file and calling it from the service? I don't want to multiply unnecessary files if there's way around it.
    Last edited by Lockheed (2015-02-26 09:37:25)

    Lockheed wrote:
    Raynman wrote:"from command line" is you feeding a (command) string to a shell. Your assumption is that systemd will treat whatever you put in ExecStart exactly the same as your shell would.
    Not "is" but "was". Disappearance of that assumption was precisely the reason of starting this thread.
    I had to read this a few times, but I think you mean it as follows. You assumed you could copy from the shell to the service file and it would work the same way. Then you got an error (about the abolute path) so that assumption "disappeared". So far so good. But you didn't exactly figure out what was different, you formed a new assumption and based your thread on that:
    "systemd service files don't allow quotes" (title)
    "Why is it not possible to use quotes in ExecStart= section of systemd service files"
    "because systemd will not run it because of presence of quotes:"
    Like frank604 says, quotes were never the issue (in fact, they are one of the few things with special meaning for both the shell and systemd), yet you still seem to think they were:
    Lockheed wrote wrote:The actual wrong assumption on my part was that this command would run without quotes as service. It does not.
    It is a shame you only quote the first part of my last reply and ignore the questions in the second part. You did almost the same thing with my reply before that and I suspect you also didn't read the man page I mentioned the first time. You basically give me the impression that you think you have it all figured out (even though you come here looking for help) and my follow-up questions aren't worth your time. That usually makes me "move along" pretty quickly, but I'm trying one last time, because even though "The service now works", I'd like to see that you actually understand why it didn't work before.
    The only thing you really answered was "Changing paths to absolute made no difference.", but that shouldn't be, so when you mentioned empirical evidence, I basically repeated the question asking for some of this evidence (as in exact error messages for one or more modified ExecStart lines).
    When I take your service file and give wget an absolute path, systemd happily executes wget, but then wget complains because it gets "&&" and "cp" and "--save" etc. as arguments. Those errors are what I see in systemctl status/journal, no longer anything about an absolute path. This is because "&&" has no special meaning. You can use semicolons (";") to separate commands instead (explained in the man page section on command lines) or multiple ExecStart lines like frank604 used (which is cleaner IMO).

  • [SOLVED] Systemd service files: sourcing other service files?

    Is there a way to "source" one systemd service file from another, so that the service inherits all settings from the other file? The purpose would be to override or append select fields as a quasi-patch of the other file, e.g.
    <source foo.service>
    [section]
    key=new_value
    I was sure that I had seen this somewhere, but I can't find it. Did I make this up, or is my search-fu simply weak?

    I don't know that it is actually documented at this point in time.  At least I haven't seen any.  The only reason I know about it is beacuse I subscribe to [systemd-devel].  But it was briefly touched on in the announcement when it was first introduced. 
    I know that the .include method is documented very briefly in one of the man pages, but it doesn't really go into depth about how to use it.  I do seem to recall a nice write up about it on Lennart's blog though.  But it seems as though the intent of the systemd.unit.d (what they are calling "drop-in" modifications/replacements) is intended to replace the .include way.  Though I am basing that statement off of the general attitude toward each on the mailing list, and I have seen no official word on this.
    The nice thing about using .include is that you can use systemd-delta to see the changes made using that method.  And while the systemd.unit.d changes are noted in that output, it is nothing more than simply indicating that there has been modification.  The .include stuff actually has a full "diff -u" style output.

  • [SOLVED] /usr/bin/echo from systemd .service

    I use systemd to execute a shell script to change the status of an LED after boot when I reach multi-user state.  It is working fine, but I wanted to execute the shell script lines from within my systemd .service file instead of the systemd .service file executing the shell script.  Below is the systemd .service file but it’s not working.  The systemctl status shows no issues, but I have a gut feeling my problem might be related to me redirecting the /usr/bin/echo to a device. Could someone lend a suggestion?
    Description=Set Green LED
    After=multi-user.target
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger
    ExecStart=/usr/bin/sleep 1
    ExecStart=/usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger
    [Install]
    WantedBy=multi-user.target
    Here is my systemctl status output:
    setgreenled.service - Set Green LED
       Loaded: loaded (/etc/systemd/system/setgreenled.service; enabled)
       Active: inactive (dead) since Tue 2013-06-04 14:12:52 PDT; 3s ago
      Process: 273 ExecStart=/usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger (code=exited, status=0/SUCCESS)
      Process: 270 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
      Process: 268 ExecStart=/usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger (code=exited, status=0/SUCCESS)
    Jun 04 14:12:51 pogoplug systemd[1]: Starting Set Green LED...
    Jun 04 14:12:52 pogoplug echo[273]: default-on > /sys/class/leds/status\:green\:health/trigger
    Jun 04 14:12:52 pogoplug systemd[1]: Started Set Green LED.
    If I execute the lines below from the command-line it works fine.
    /usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger
    /usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger
    If I put the commands into a shell script and use systemd .service to execute the shell script, it works fine.  Here is that .service script
    [Unit]
    Description=Set Green LED
    After=multi-user.target
    [Service]
    Type=simple
    ExecStart=/usr/bin/sh /home/public/setgreenled.sh
    [Install]
    WantedBy=multi-user.target
    Last edited by calzon65 (2013-06-05 00:55:37)

    Systemd services are not shells.  So redirects will not work in that way.  You can use "bash -c '<command here>'" to accomplish this as that will create a shell for the command to run.  But I think that berbae is right that there are better alternatives for this.
    You can use tmpfiles (man tmpfiles.d) which you can use to simply write a value to the given path, or you can use a udev rule to run a command when that particular path is detected.  Beware though that for some things, the tmpfiles way will sometimes try to run itself before the actual creation of the directory.  So you may run into some pace conditions with that method.  For some things, it is totally reliable though... so you'll just have to test and see.
    A tmpfiles.d configuration is way easier to write than a udev rule.  But what you are trying to do would be a pretty basic udev rule, so it would probably not take you very long to learn how to do it.  It simply involves learning how to use the udevadm command really.

  • Creating an IBus systemd service file

    I currently start ibus-daemon with the following in my ~/.xprofile:
    ibus-daemon --daemonize --xim
    The thing is this does not display very nicely in the output of `systemctl status`; there're several ibus related processes listed, all in the same process Group ID. I figure if I write an ibus.service and manage it with systemctl, they would be grouped together in the output of `systemctl status`, correct?
    In any case, I'm trying to write an IBus systemd service file. What I have so far:
    [Unit]
    Description=Intelligent Input Bus
    Documentation=man:ibus-daemon(1)
    [Service]
    Type=dbus
    BusName=org.freedesktop.IBus
    ExecStart=/usr/bin/ibus-daemon --replace --xim --panel disable
    ExecReload=/usr/bin/ibus restart
    ExecStop=/usr/bin/ibus exit
    [Install]
    WantedBy=default.target
    I put the above in file ~/.config/systemd/user/ibus.service and tried
    % systemctl --user start ibus.service
    For 90 seconds the command didn't return. In that time, ibus-daemon was in fact started, I used the command `ibus` to check that the Bus part was working normally. 90 seconds later systemd bailed out,
    Job for ibus.service failed. See 'systemctl status ibus.service' and 'journalctl -xn' for details.
    Nothing useful in the journal, really,
    systemd[388]: Starting Intelligent Input Bus...
    systemd[388]: ibus.service start operation timed out. Terminating.
    systemd[388]: Failed to start Intelligent Input Bus.
    systemd[388]: Unit ibus.service entered failed state.
    What was not working during the 90 seconds was I couldn't actually use IBus to input anyting. I was able to switch engines with `ibus engine <foo>` but if then I started typing IBus was not used at all.
    Compare the process tree between manually running ibus-daemon and using systemctl start,
    ibus-daemon --replace --xim --panel disable
    systemd,1,1
    |-gnome-terminal-,485,440
    | |-zsh,7299,7299
    | | `-ibus-daemon,9732,9732 --replace --xim --panel disable
    | | |-ibus-dconf,9736,9732
    | | | |-{dconf worker},9743,9732
    | | | |-{gdbus},9742,9732
    | | | `-{gmain},9740,9732
    | | |-{gdbus},9739,9732
    | | `-{gmain},9733,9732
    `-ibus-x11,9738,9732 --kill-daemon
    |-{gdbus},9746,9732
    `-{gmain},9745,9732
    systemctl --user start ibus
    systemd,1,1
    `-systemd,388,388 --user
    |-(sd-pam),390,388
    `-ibus-daemon,9911,9911 --replace --xim --panel disable
    |-ibus-dconf,9914,9911
    | |-{dconf worker},9921,9911
    | |-{gdbus},9919,9911
    | `-{gmain},9917,9911
    |-{gdbus},9920,9911
    |-{gmain},9912,9911
    `-{pool},9926,9911
    I see two differences: 1) ibus-x11 is present only if ibus-daemon is run manually; 2) Note the {pool} process in the systemctl case.
    UPDATE²
    ibus-x11 will fail to start silently if the DISPLAY env is not set, which is the case in the systemd env. Damn. When I set Environment="DISPLAY=:0" ibus-x11 is started just fine.
    So the question remaining here, is why Type=dbus does not work?
    I also tried to comment use Type=simple without BusName= to the same result.
    UPDATE
    I forgot to systemctl daemon-reload!
    With Type=simple ibus-daemon *is* started. BUT, ibus-x11, which is supposed to be started with the --xim option, is not started. I guess it's because it forks? I'll try something.
    I do feel it should be Type=dbus though, and I also found a file, part of the gnome-settings-daemon package, /usr/share/dbus-1/services/org.freedesktop.IBus.service with the content:
    [D-BUS Service]
    Name=org.freedesktop.IBus
    Exec=/usr/bin/ibus-daemon --replace --xim --panel disable
    Any idea how to make systemd happy?
    Last edited by lolilolicon (2014-07-31 14:10:37)

    The first post is too long... Let me update the status with a new post.
    The user service file currently looks like this:
    # [email protected]
    [Unit]
    Description=Intelligent Input Bus
    Documentation=man:ibus-daemon(1)
    [Service]
    Environment="DISPLAY=%I"
    ExecStart=/usr/bin/ibus-daemon --replace --xim --panel disable
    ExecReload=/usr/bin/ibus restart
    ExecStop=/usr/bin/ibus exit
    [Install]
    WantedBy=default.target
    And you can enable it for the current DISPLAY via
    % systemctl --user enable "ibus@$DISPLAY.service"
    DISPLAY must be set for the --xim option to work.
    According to systemd.exec(5), "processes started by user systemd instances inherit all environment variables from the user systemd instance". But at the time the user systemd instance is started, the DISPLAY env is not set yet, so I'm using the %I place holder here.
    Although there doesn't seem to be much benefit, I still wonder why Type=dbus doesn't work. Is systemd looking for the wrong bus?

  • [solved] writing systemd service file to run script

    i have completely migrated to systemd. now, i am trying to write a service file to run a startup script (~/.startup.sh). one of the functions of the script is to set the brightness of the screen:
    echo "95" > /sys/class/backlight/intel_backlight/brightness
    i created /etc/systemd/system/startup.service:
    [Unit]
    Description=Run startup script
    [Service]
    Type=oneshot
    ExecStart=~/.startup.sh
    [Install]
    WantedBy=multi-user.target
    but i get the following error:
    Failed to issue method call: Unit startup.service failed to load: Invalid argument. See system logs and 'systemctl status startup.service' for details.
    i have two questions:
    1. what am i missing?
    2. how can i avoid permission issues associated with modifying the brightness file (e.g., permission denied errors, the need to put in the password, etc.)?
    thanks.
    Last edited by anti-destin (2012-08-01 22:26:04)

    thanks for the replies.
    just a note: using an absolute path didn't fix the issue.
    but i went ahead and created the file /etc/tmpfiles.d/backlight.conf:
    w /sys/class/backlight/intel_backlight/brightness - - - - 95
    and that worked.
    is there a reason for recommending using a tmpfile rather than a service?
    in any case, i'm marking this as solved.

  • [solved] Writing systemd service file - forking no pidfile

    Hey all,
    I am trying to write .service files for TORQUE, but am having some difficulty and quite can't understand the docs.  Here's what I have so far for the server
    [Unit]
    Description=TORQUE server
    Wants=basic.target
    After=basic.target network.target
    [Service]
    Type=forking
    PIDFile=/run/torque-server.pid
    ExecStart=/usr/sbin/pbs_server
    [Install]
    WantedBy=multi-user.target
    The problem I'm having is with the PIDFile - pbs_server doesn't provide an option (as far as I can see) to specify a pid file... is this something that systemd can generate on its own, or what's the normal solution here?
    Without the PIDFile specified systemctl start returns immediately and no process exists, with the PIDFile systemctl start stalls for a while and then has an error saying it couldn't find the pid file (surprise), but pbs_server is left running.
    Thanks for any help
    Last edited by dandaman0061 (2012-12-13 19:58:36)

    Nevermind - it appears that pbs_server creates a pid file at $TORQUE_HOME/server_priv/server.lock where using torque from the AUR is /var/spool/torque
    Chaging the pidfile setting in the service file to this now works.

  • Systemd service file question (trying to start nilfs-cleanerd)

    My root file system is nilfs2. Yay!
    But I can't get the cleanerd to auto-start.
    According to the documentation, for root file systems, I need to run a manual command to start it.
    I tried creating a unit (service) file to do this, but systemd doesn't seem to recognize it.
    I create the file as /etc/systemd/system/nilfs-cleanerd.service, but I get an error trying to enable it.
    I also have it as a "wants" to try to auto-run it.
    Shell output, showing the file, and the command/error:
    [root@robot1 /]# systemctl enable nilfs-cleanerd.service
    Failed to issue method call: Invalid argument
    [root@robot1 /]# cat /etc/systemd/system/nilfs-cleanerd.service
    [Unit]
    Description=Garbage collect NILFS segments
    After=local-fs.target
    [Service]
    ExecStart=/sbin/nilfs_cleanerd
    Type=simple
    [Install]
    Alias=nilfs-cleanerd.service
    WantedBy=local-fs.target.wants
    [root@robot1 /]#
    So, how do I debug this error? There's no "-v" option to systemctl to get more verbose error messages that might give a hint about where in the operation it fails.
    Also, there seems to be a cleanerd running somehow:
    [root@robot1 /]# ps alx | grep ni[l]
    1 0 222 2 20 0 0 0 nilfs_ S ? 0:03 [segctord]
    4 0 223 1 20 0 14692 864 wq_sle Ss ? 0:00 /sbin/nilfs_cleanerd -n /dev/sda1 /
    [root@robot1 /]#
    but nilfs-clean doesn't find it:
    [root@robot1 /]# nilfs-clean
    No cleaner found on /dev/sda1.
    [root@robot1 /]#
    so it may be that my problem is related to nilfs-clean rather than the systemctl command. But I still want to understand how to debug this systemctl error.

    tomk wrote:Finally if you think the wiki is not clear enough on what goes where, you can improve it yourself.
    I'd be happy to improve it, once I find the authoritative source that tells me what the rule is.
    You're not actually answering the question, though, unless I'm supposed to read between the lines.
    Are you saying that locally defined services should, in fact, have their files live in /etc/systemd/system ? Because when I select particular services, symlinks get generated in /etc/systemd/system. Here's the output of "ls -l /etc/systemd/system" on my machine:
    [jwatte@robot1 Onyx]$ ls -l /etc/systemd/system
    total 40
    -rw-r--r-- 1 root root 1662 Dec 14 05:00 [email protected]
    lrwxrwxrwx 1 root root 41 Dec 14 05:05 default.target -> /usr/lib/systemd/system/multi-user.target
    lrwxrwxrwx 1 root root 36 Dec 14 04:50 display-manager.service -> /usr/lib/systemd/system/lxdm.service
    drwxr-xr-x 2 root root 4096 Dec 14 05:01 getty.target.wants
    drwxr-xr-x 2 root root 4096 Dec 30 15:57 local-fs.target.wants
    drwxr-xr-x 2 root root 4096 Dec 29 20:19 multi-user.target.wants
    -rwxr-xr-x 1 root root 191 Dec 30 15:57 nilfs-cleanerd.service
    drwxr-xr-x 2 root root 4096 Dec 29 20:19 printer.target.wants
    drwxr-xr-x 2 root root 4096 Dec 29 20:19 sockets.target.wants
    drwxr-xr-x 2 root root 4096 Nov 22 07:21 sysinit.target.wants
    [jwatte@robot1 Onyx]$
    Note the symlinks for default.target and display-manager.service. Then again, [email protected] is a file living in this directory.
    The problem then becomes: Why do I get the error listed at the beginning of this post?
    Here's the output of ls -l on local-fs.target:
    [jwatte@robot1 Onyx]$ ls -l /etc/systemd/system/local-fs.target.wants/
    total 4
    lrwxrwxrwx 1 root root 42 Dec 30 15:57 nilfs-cleanerd.service -> /etc/systemd/system/nilfs-cleanerd.service
    [jwatte@robot1 Onyx]$
    Last edited by jwatte (2013-01-01 22:52:01)

  • Help create systemd .service file for Teeworlds server

    Hi there.
    I maintain one package the provide server for the game Teeworlds (teeworlds-zcatch in AUR). I'd like to have a ".service" file to be able to run the server in background, maybe even in startup, and saving the log (it send some stuff to stdout that could be nice to keep). However I don't know how to make a ".service" script. Could somene create a script or point me out to informations about it?
    Thanks in advance

    Hi.
    https://bbs.archlinux.org/viewtopic.php … 9#p1363959
    There I explain a little a .service that I'm using. Maybe it be useful.
    And in this wikipage there are several examples
    https://wiki.archlinux.org/index.php/Systemd/Services

  • Error trying to write to a measurement file and then send via gmail.vi

    So as the title says, I have a VI which is writing to a tdms file, and I want to send the file by gmail once the program has completed it's run. I downloaded gmail.vi and am integrating it into my existing code. Both my original code and the gmail VI work fine on their own, but when I try to have the combined VI send the data file by email, I get the error message that I've attached.
    Basically, it seems like the .tdms data file is in use by the measurement code, and I need to know how to free it up so that the gmail code can attach and send it.
    I've attached the main code as well as my modified gmail VI, so hopefully someone can take a look at tell me what I'm missing.
    Any help is much appreciate!
    Attachments:
    Error.PNG ‏19 KB
    PID Controller - Cleaned Up.vi ‏239 KB
    Email Alert.vi ‏19 KB

    While I can't view all of your code because it is missing several SubVIs, I have a good idea of what you are trying to do. I believe the culprit is the "Write to measurement file" express VI. Near as I can tell the original reference to the TDMS file is being held open inside the express VI. Here's a good general rule for using Express VI's: when you see them, RUN THE OTHER WAY! I say because there is almost always a significant amount of code in there that is unnecessary, In this case, you simply need the Open TDMS file, Write to TDMS, Close file functions; you do not need all of the extra code that is in the express VI's.
    <edit> P.S. I hope the username/password in Email alert.vi is a placeholder otherwise you just gave every idiot with access to LabVIEW your username and password to the account.
    Charles Chickering
    Architecture is art with rules.
    ...and the rules are more like guidelines

  • Systemd .service files typo

    When installing systemd, I had quite some problems trying to get wpa_supplicant to work with it. After a load of head-scratching and rebooting, I found that /usr/lib/systemd/system/[email protected] appeared to have a typo. [email protected] Requires(and is called After) sys-subsystem-net-devices-%i.device(Line 3 and 4). This surprised me, as the rest of the file's occurances of "%i" are with uppercase i's. So, I changed "%i" to "%I", rebooted, and bam! it worked. So, I was originally going to file a bug about this, but suddenly realized that [email protected] was not the only file using lowercase i's.
    [root@Soundwave]system# pwd
    /usr/lib/systemd/system
    [root@Soundwave]system# find . | xargs grep "%i"
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    ./[email protected]:BindsTo=dev-%i.device
    ./[email protected]:After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
    ./[email protected]:BindsTo=%i.device
    ./[email protected]:After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
    ./[email protected]:Description=OpenVPN connection to %i
    ./[email protected]:ExecStart=/usr/sbin/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --cd /etc/openvpn
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    My wpa_supplicant did not work with lowercase i's. So, is this a typo or is this somehow how it's supposed to be?

    When installing systemd, I had quite some problems trying to get wpa_supplicant to work with it. After a load of head-scratching and rebooting, I found that /usr/lib/systemd/system/[email protected] appeared to have a typo. [email protected] Requires(and is called After) sys-subsystem-net-devices-%i.device(Line 3 and 4). This surprised me, as the rest of the file's occurances of "%i" are with uppercase i's. So, I changed "%i" to "%I", rebooted, and bam! it worked. So, I was originally going to file a bug about this, but suddenly realized that [email protected] was not the only file using lowercase i's.
    [root@Soundwave]system# pwd
    /usr/lib/systemd/system
    [root@Soundwave]system# find . | xargs grep "%i"
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    ./[email protected]:BindsTo=dev-%i.device
    ./[email protected]:After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
    ./[email protected]:BindsTo=%i.device
    ./[email protected]:After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
    ./[email protected]:Description=OpenVPN connection to %i
    ./[email protected]:ExecStart=/usr/sbin/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --cd /etc/openvpn
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    ./[email protected]:Requires=sys-subsystem-net-devices-%i.device
    ./[email protected]:After=sys-subsystem-net-devices-%i.device
    My wpa_supplicant did not work with lowercase i's. So, is this a typo or is this somehow how it's supposed to be?

  • Almost solved, just need help with a service file!

    Hey all,
    For some time now my systemd sleep hook has stopped working (e.g. only killing my program and not relaunching it when waking up). Only now I have time to look into it, though, so I can't really say if any update caused this.
    I had a custom sleep hook in /usr/lib/systemd/system-sleep/dwmstatus.sh, which killed my dwm-status program before going to sleep/suspend and started it again when waking up. It looked like this:
    #!/bin/sh
    case $1 in
    pre) killall dwm-status
    post) dwm-status
    esac
    exit
    I've been looking into it and noticed the example on the Wiki (my previous script above was a direct copy of the old example) got updated, so I updated mine accordingly. It now looks like this:
    #!/bin/sh
    case $1/$2 in
    pre/*)
    echo "Going to $2, killing dwm-status"
    killall dwm-status
    echo "dwm-status killed"
    post/*)
    echo "Waking up from $2, starting dwm-status"
    exec /usr/bin/dwm-status &
    echo "dwm-status started"
    esac
    But that's not working either. (The echos are just here for debugging this). I first tried using just dwm-status to start it again, but it didn't work. Then I tried the full path without result too and now with exec I still am not getting anywhere. Can someone explain to me why it's not working anymore?
    Last edited by Unia (2012-12-24 13:31:46)

    Now that I have solved all the outstanding issues and integrated quite a bunch of new features into dwmst (rename of dwm-status) it's only this issue that needs to be resolved. I still can't get dwmst to launch again after suspend/hibernate.
    I checked journalctl but it comes up without any errors whatsoever:
    ┌─[jente @ lappy ~] 20:07:40
    └─■ sudo journalctl -b -u systemd-suspend
    -- Logs begin at wo, 2012-10-31 12:43:25 CET, end at wo, 2012-12-19 20:08:36 CET. --
    dec 19 20:08:10 lappy systemd-sleep[1174]: xset: unable to open display ""
    dec 19 20:08:10 lappy systemd-sleep[1174]: Suspending system...
    dec 19 20:08:19 lappy systemd-sleep[1174]: System resumed.
    dec 19 20:08:19 lappy systemd-sleep[1174]: ERROR: could not open display
    dec 19 20:08:19 lappy systemd-sleep[1174]: xset: unable to open display ""
    Or is it that xset error?
    EDIT: I just removed my script from /usr/lib/systemd/system-sleep to check the output, and I still get the xset error but not the ERROR line:
    dec 19 20:12:12 lappy systemd-sleep[1329]: xset: unable to open display ""
    dec 19 20:12:12 lappy systemd-sleep[1329]: Suspending system...
    dec 19 20:12:21 lappy systemd-sleep[1329]: System resumed.
    dec 19 20:12:21 lappy systemd-sleep[1329]: xset: unable to open display ""
    So I guess that ERROR: could not open display is the error dwmst generates when it tries to launch it? Further investigation will have to follow, but in the meantime I'm open for pointers!
    EDIT2: The ERROR line is not related to dwmst. I put some echo lines before and after killing and launching dwmst and the ERROR line appears after the echo's:
    dec 19 20:16:57 lappy systemd-sleep[1443]: System resumed.
    dec 19 20:16:57 lappy systemd-sleep[1443]: starting dwmst
    dec 19 20:16:57 lappy systemd-sleep[1443]: started dwmst
    dec 19 20:16:57 lappy systemd-sleep[1443]: ERROR: could not open display
    dec 19 20:16:57 lappy systemd-sleep[1443]: xset: unable to open display ""
    Last edited by Unia (2012-12-19 19:18:34)

  • Removing the user define comments while trying to write to the property fil

    Hi All,
    While using new Properies().setPropety(). It is removing the user define comments from property file.
    Could you please explain me why it is happening and how can I restrict it
    Thanks & Regards
    Edited by: Rakesh83 on Feb 20, 2008 4:33 AM

    Rakesh83 wrote:
    Could you please provde me sample code for this?
    #! /usr/bin/groovy
    xml = '''
    <config>
        <property name="foo" value="bar" comment="blah, blah, blah" />
        <property name="baz" value="qux" comment="doodle doodle dee" />
    </config>
    def config = new XmlParser().parse(new StringReader(xml))
    def property = config.property.find { it.'@name' =~ 'baz' }
    assert 'doodle doodle dee' == property.@comment
    property.@value = 'snorp'
    assert 'doodle doodle dee' == property.@comment // comments preserved!
    // write xml as needed~

Maybe you are looking for

  • Issue in WAD Dropdown box functionality. Help req.

    Hello, Issue in WAD and Bex. I have two dropdown boxes in the web templates, for ex cost center and controlling area. DDBox1: Controlling Area. DDBox2: Cost center. Step1: I am selecting Controlling area 4002 Step2: I am selecting cost center 691 Ste

  • How can I replace a brand new, but malfunctional iPhone 4?

    Hey, guys. I am from Russia, and on our recent trip to Munich, Germany we've bought a new iPhone 4 8gb for my wife at the Apple Store. When we got home in a couple of days, I unboxed it, plugged in and proceed to install iOS6 wirelessly. On the next

  • Error in sales order saving

    hi Gurus i have  single problem related with sales order. while i saving the sales order it gives dump error. error details. Maintain the current CRM release (table CRMPAROLTP) Diagnosis    Various transfer errors occur when transferring SAP sales or

  • Mail avatar no longer displays how many new messages

    Mail used to show the number of unread messages in its avatar --a number would appear in a little red circle--but that no longer happens.  Is that a new Mavericks thing?  Notifications are fine if you're working in Mail but I want to see how many unr

  • Auditing - Drop Statements? Can't get it to work!

    Hi all, forgive me if im doing something really stupid, but i can't seem to audit 'drop' statements and i have scanned the net for solutions but can't seem to get anythig to work. Any advice / ideas? :) details - (if any of this helps!) sys@database>