[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.

Similar Messages

  • [SOLVED] Freezing while executing /usr/bin/openbox from Openbox menu

    I'm following the instructions in this webpage to create a dynamic menu. I have successfully achieved this on my laptop by installing the openbox-menu package and typing the following lines in menu.xml:
    <menu id="desktop-app-menu" label="Applications" execute="/usr/bin/openbox-menu lxde-applications.menu" />
    For some reason, the same doesn't work on my desktop PC. After editing and saving the menu.xml file, I restart Openbox and when I right click the desktop and hover the "Applications" menu item the desktop freezes. However, I can still move the mouse and switch to other ttys with Ctrl+Alt+Fx, therefore I believe it's reasonable to suggest that the problem lies in the permissions.
    What should I do about it?
    Last edited by Martificiam (2013-02-03 11:29:21)

    Umm, that's not "some random" webpage at all... It worked on all of my Arch Linux installations. The "lxde-applications.menu" is just an argument. But thanks for the link, I'll look into it.
    It's just that it's more of a workaround, not a solution, really... since it has ALWAYS worked for me.
    Furthermore, while setting up Arch on my laptop I remember experiencing similar problems (running a particular program from the openbox menu and resulting in a desktop freeze). This must have something to do with permissions.
    Edit: the xdg_menu worked perfectly, but I would still prefer to use the openbox-menu. I'm marking this as solved anyway.
    Last edited by Martificiam (2013-02-03 11:29:06)

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

  • Executing /usr/bin/mail From Within Daemon

    I've created a script that, among other things, sends an email to an external email address and it works fine from the command line.  When the same script is run periodically from within a daemon (i.e. launchctl), the email functionality of the script does not execute.  There are no errors in the system.log, the appfirewall.log or the mail.log.  All of my referenced paths are absolute.  I'm overlooking something, but don't know what.
    Python:
    cmd = "/bin/echo \"%s\" | /usr/bin/mail -s \"%s\" %s" % (messageText.strip(),subject,receiver)
    os.system(cmd)
    The question is, why does /usr/bin/mail not function correctly from within a daemon?
    I appreciate your assistance

    > Checked man mail but nothing that I could see...
    That's because you're looking in the wrong place
    mail uses your current login name combined with the domain settings for postfix, so it's postfix's configuration you need to be looking at.
    Specifically:
    /etc/postfix/main.cf
    which states:
    # The myorigin parameter specifies the domain that locally-posted
    # mail appears to come from. The default is to append $myhostname,
    # which is fine for small sites.
    So you should change the myorigin setting to reflect the @part of addresses for mail sent from this machine. It may be as simple as:
    myorigin = $mydomain
    if you just want to append your domain name.

  • SOLVED /usr/bin/makepkg: line 552: build: command not found

    I'm trying to build a custom kernel, but am receiving this error:
    /usr/bin/makepkg: line 552: build: command not found
    I've searched all over for a fix, but haven't had any luck, it doesn't seem to be a common error, or it's so incredibly easy to fix that noone has bothered 
    Thanks for any help.
    /crobot

    Thanks for your response, it has failed on two builds, i'll post both.
    Here's the first:
    # $Id: PKGBUILD,v 1.26 2004/10/06 18:21:54 judd Exp $
    # Maintainer: judd <[email protected]>
    pkgname=kernel26
    pkgver=2.6.8.1
    pkgrel=3
    pkgdesc="The Linux Kernel and modules (IDE support)"
    url="http://www.kernel.org"
    backup=('boot/kconfig26')
    depends=('module-init-tools')
    install=kernel26.install
    source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2
    config cdburning.patch logo_linux_clut224.ppm
    bio_uncopy_user-mem-leak.patch bio_uncopy_user-mem-leak-fix.patch
    http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/26-stable-release/acpi-20040715-2.6.8.diff.bz2)
    md5sums=('9517ca999e822b898fbdc7e72796b1aa' '20ad5bea85099dfcced9a6b91064b04e'
    '66b87662e6dd54b6324f874739fa1b99' '5a62bcc7e96601052c7405459b483826'
    'd2329bc663089cd99b8dbfd25b6a7ebc' '15a9165ae02c4a3a3875fb7924a68cbf'
    'e00d08709581f215b15e321d162f782c')
    build() {
    cd $startdir/src/linux-$pkgver
    patch -Np1 -i ../bio_uncopy_user-mem-leak.patch || return 1
    patch -Np1 -i ../bio_uncopy_user-mem-leak-fix.patch || return 1
    patch -Np1 -i ../cdburning.patch || return 1
    #patch -Np1 -i ../acpi-20040715-2.6.8.diff || return 1
    # Arch logo!
    cp ../logo_linux_clut224.ppm drivers/video/logo/
    # get rid of the 'i' in i686
    carch=`echo $CARCH | sed 's|i||'`
    cat ../config | sed "s|#CARCH#|$carch|g" >./.config
    yes "" | make config
    make clean bzImage modules || return 1
    mkdir -p $startdir/pkg/{lib/modules,boot}
    make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
    cp System.map $startdir/pkg/boot/System.map26
    cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26
    install -D -m644 Makefile $startdir/pkg/usr/src/linux-$pkgver/Makefile
    install -D -m644 .config $startdir/pkg/usr/src/linux-$pkgver/.config
    install -D -m644 .config $startdir/pkg/boot/kconfig26
    mkdir -p $startdir/pkg/usr/src/linux-$pkgver/include
    mkdir -p $startdir/pkg/usr/src/linux-$pkgver/arch/i386/kernel
    for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-$pkgver/include/
    done
    # copy files necessary for later builds, like nvidia and vmware
    cp -a scripts $startdir/pkg/usr/src/linux-$pkgver/
    mkdir -p $startdir/pkg/usr/src/linux-$pkgver/.tmp_versions
    cp arch/i386/Makefile $startdir/pkg/usr/src/linux-$pkgver/arch/i386/
    cp arch/i386/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-$pkgver/arch/i386/kernel/
    # copy in Kconfig files
    for i in `find . -name "Kconfig*"`; do
    mkdir -p $startdir/pkg/usr/src/linux-$pkgver/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-$pkgver/$i
    done
    cd $startdir/pkg/usr/src/linux-$pkgver/include && ln -s asm-i386 asm
    chown -R root.root $startdir/pkg/usr/src/linux-$pkgver
    cd $startdir/pkg/lib/modules/$pkgver &&
    (rm -f source build; ln -sf /usr/src/linux-$pkgver build)
    Here's the second:
    ###### Give the kernel a unique name (for multiple builds - can be empty)
    _kerrev=crobot
    ###### Choose generic name, version, and release. updated later for $_kerrev
    pkgname=kernel26
    pkgver=2.6.8.1
    pkgrel=1
    pkgdesc="Custom Linux Kernel and modules"
    url="http://www.kernel.org"
    depends=('module-init-tools')
    ###### Add a default config file and any patches to be applied to source array
    source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2)
    ###### Add md5 checksums here:
    #md5sum=()
    getvar() {
    old=$(cat Makefile | grep "^$1")
    echo $(echo ${old/"$1 ="/} | sed -e "s/[ ]*(.*)[ ]*/1/g")
    return 0
    build() {
    cd $startdir/src/linux-$pkgver
    ###### apply patches here
    # patch -p1 < ../patch1 #model
    #get rid of i in i686 in default config
    carch=`echo $CARCH | sed 's|i||'`
    cat ../config | sed "s|#CARCH#|$carch|g" >./.config
    ###### Choose one of the following configuration types
    ###### Use first option for config in source array
    #yes "" | make config
    #make oldconfig || return 1
    make menuconfig
    #make xconfig
    #make gconfig
    ##### No user changes below here
    # save the configuration with today's date
    cp ./.config ../../NEWCONFIG-$(date +%b%d)
    # set EXTRAVERSION to create unique /lib/modules/ subdirectories
    _ker_extraversion=$(getvar "EXTRAVERSION")
    # update EXTRAVERSION in the Makefile by adding our _kerrev
    _oldline=$(cat Makefile | grep "^EXTRAVERSION")
    if [ $_kerrev != "" ]; then
    _ker_extraversion="$_ker_extraversion-$_kerrev"
    cat Makefile | sed "s|$_oldline|EXTRAVERSION = $_ker_extraversion|" > tmpMake
    mv tmpMake Makefile
    fi
    _kerrev=$_ker_extraversion
    kerver=$(getvar "VERSION").$(getvar "PATCHLEVEL").$(getvar "SUBLEVEL")
    # update the package information from the kernel Makefile
    # (just in case the Makefile changed during a patch)
    pkgver=$kerver$(echo $_kerrev | sed -e 's/-/./g')
    pkgdesc="Custom Linux Kernel and modules version: $kerver revision: $_kerrev /
    package ver: $pkgver build: $pkgrel"
    # changing the package name
    # removing patches versions from the revision string
    _t=$(echo $_kerrev | sed -e "s/^..[0-9]*//g")
    # _t=$(echo $_t | sed -e "s/^-rc[0-9]?*//g")
    # _suf contains the suffix identifying the kernel (it has the versions removed from
    it)
    _suf=$(echo $_t | sed -e "s/[0-9]*-/-/g")
    pkgname=kernel26$_suf
    echo "Package name: $pkgname"
    echo "Package ver: $pkgver"
    echo "Package desc: $pkgdesc"
    sleep 5
    make clean bzImage modules || return 1
    mkdir -p $startdir/pkg/{lib/modules,boot}
    make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
    # create unique names in /boot/
    cp System.map $startdir/pkg/boot/System.map26$_suf
    cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26$_suf
    install -D -m644 Makefile $startdir/pkg/usr/src/linux-$kerver/Makefile
    install -D -m644 .config $startdir/pkg/usr/src/linux-$kerver/.config
    install -D -m644 .config $startdir/pkg/boot/kconfig26$_suf
    mkdir -p $startdir/pkg/usr/src/linux-$kerver/include
    mkdir -p $startdir/pkg/usr/src/linux-$kerver/arch/i386/kernel
    for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-$kerver/include/
    done
    # copy files necessary for later builds, like nvidia and vmware
    cp -a scripts $startdir/pkg/usr/src/linux-$kerver/
    mkdir -p $startdir/pkg/usr/src/linux-$kerver/.tmp_versions
    cp arch/i386/Makefile $startdir/pkg/usr/src/linux-$kerver/arch/i386/
    cp arch/i386/kernel/asm-offsets.s
    $startdir/pkg/usr/src/linux-$kerver/arch/i386/kernel/
    # copy in Kconfig files
    for i in `find . -name "Kconfig*"`; do
    mkdir -p $startdir/pkg/usr/src/linux-$kerver/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-$kerver/$i
    done
    cd $startdir/pkg/usr/src/linux-$kerver/include && ln -s asm-i386 asm
    chown -R root.root $startdir/pkg/usr/src/linux-$kerver
    # create a unique subdirectory under /usr/src/
    cd $startdir/pkg/usr/src
    mv linux-$kerver linux-$kerver$_kerrev
    cd $startdir/pkg/lib/modules/$kerver$_kerrev &&
    (rm -f build; ln -sf /usr/src/linux-$kerver$_kerrev build)
    Thanks,
    /crobot

  • [SOLVED] /usr/bin/env: No such file or directory

    Hi,
    I've tried to install a couple packages from the AUR, but when I run "makepkg -s", I get this error:
    /usr/bin/env: No such file or directory
    make: *** [install] Error 127
    ==> ERROR: A failure occurred in package().
        Aborting...
    I'm sorry if this is something terribly simple, but I can't find any mention of /usr/bin/env anywhere.
    I have coreutils installed, which I believe env is part of.
    Thank you for any help!
    Last edited by dluco (2013-09-24 01:37:11)

    The /usr/bin/env is provided by the coreutils package. 
    You didn't run into issues when there was the move from /bin, /sbin, /usr/sbin → /usr/bin ?  This happened back in the beginning of June!  You need to read the front page news.
    If this is the case, I am venturing to guess that your system is probably not actually up to date, and even that you might have been doing partial updates for some time now…
    Edit: Check /bin, /sbin, and /usr/sbin and see if they are symlinks pointing to /usr/bin.  If they are, you apparently made it through that update unscathed.  If they are not, well…
    Last edited by WonderWoofy (2013-09-23 16:25:19)

  • [SOLVED] /usr/bin/makepkg: line 337:

    I have a problem installing packages from AUR with yaourt:
    ==> Making package: virtualbox_bin 3.2.4-1 i686 (Tue Jun  8 15:01:07 EEST 2010)
    ==> Checking Runtime Dependencies...
    ==> Checking Buildtime Dependencies...
    ==> Retrieving Sources...
    ==> ERROR: The download program wget is not installed.
        Aborting...
      -> Downloading VirtualBox-3.2.4-62431-Linux_x86.run...
    /usr/bin/makepkg: line 337: http://download.virtualbox.org/virtualb … ux_x86.run: No such file or directory
    ==> ERROR: Failure while downloading VirtualBox-3.2.4-62431-Linux_x86.run
        Aborting...
    ==> ERROR: Makepkg was unable to build virtualbox_bin.
    ==> Restart building virtualbox_bin ? [y/N]
    Last edited by Cosmin (2010-06-08 12:57:34)

    ber_t wrote:
    Cosmin wrote:
    I have a problem installing packages from AUR with yaourt:
    ==> Making package: virtualbox_bin 3.2.4-1 i686 (Tue Jun  8 15:01:07 EEST 2010)
    ==> Checking Runtime Dependencies...
    ==> Checking Buildtime Dependencies...
    ==> Retrieving Sources...
    ==> ERROR: The download program wget is not installed.
        Aborting...
      -> Downloading VirtualBox-3.2.4-62431-Linux_x86.run...
    /usr/bin/makepkg: line 337: http://download.virtualbox.org/virtualb … ux_x86.run: No such file or directory
    ==> ERROR: Failure while downloading VirtualBox-3.2.4-62431-Linux_x86.run
        Aborting...
    ==> ERROR: Makepkg was unable to build virtualbox_bin.
    ==> Restart building virtualbox_bin ? [y/N]
    Seems like wget isn't installed.
    Thank you. That was the problem.

  • [SOLVED]/usr/bin/X -nolisten tcp

    What is /usr/bin/X -nolisten tcp and what does it do? (accept eating cpu and ram)
    Is there a way to get rid of it?
    Thanks in advance
    Last edited by Roline (2010-01-06 14:49:27)

    Roline wrote:
    What is /usr/bin/X -nolisten tcp and what does it do? (accept eating cpu and ram)
    Is there a way to get rid of it?
    Thanks in advance
    That is your X server.  You kinda need that.  Sometimes you will see it using/ taking up some cpu.. that is normal.

  • [invalid] Run systemd service after specific device is initialized

    Hi.
    Is there any way to run systemd service only after specific device is initialized/kernel module is loaded?
    The task I'm trying to solve is applying trackpoint speed and sensitivity settings on boot in my X220.
    Service code (trackpoint.service) is quite simple
    [Unit]
    Description=Trackpoint configuration
    [Service]
    Type=oneshot
    EnvironmentFile=/etc/conf.d/trackpoint.conf
    ExecStart=/bin/sh -c 'echo ${sensitivity} > /sys/devices/platform/i8042/serio1/serio2/sensitivity'
    ExecStart=/bin/sh -c 'echo ${speed} > /sys/devices/platform/i8042/serio1/serio2/speed'
    [Install]
    WantedBy=graphical.target
    The issue is that trackpoint.service gets executed before trackpoint device gets initialized and thus fails.
    Jun 14 23:12:10 xi sh[414]: /bin/sh: /sys/devices/platform/i8042/serio1/serio2/sensitivity: No such file or directory
    Jun 14 23:12:10 xi systemd[1]: Unit trackpoint.service entered failed state.
    Jun 14 23:12:18 xi kernel: psmouse serio2: trackpoint: IBM TrackPoint firmware: 0x0e, buttons: 3/3
    Jun 14 23:12:18 xi kernel: input: TPPS/2 IBM TrackPoint as /devices/platform/i8042/serio1/serio2/input/input13
    What have I tried already
    1. Specified systemd-modules-load in After= and Requires= directives and added psmouse module to /etc/modules-load.d
    2. Tried path activation (perhaps, I did it wrong) by creating i8042.path
    [Path]
    PathExists=/sys/devices/platform/i8042
    Unit=trackpoint.service
    However, this changed nothing.
    I don't know what else should I try.
    Please suggest solution for this.
    Thanks in advance.
    Last edited by eDio (2013-06-15 13:28:36)

    Thank you very much.
    I've finally managed this to work
    $ cat /etc/udev/rules.d/10-trackpoint.rules
    SUBSYSTEM=="input", KERNEL=="event13", ACTION=="add", RUN+="/usr/bin/trackpoint_apply"
    $ cat /etc/conf.d/trackpoint.conf
    speed=255
    sensitivity=255
    $ cat /usr/bin/trackpoint_apply
    #!/usr/bin/env sh
    . /etc/conf.d/trackpoint.conf
    /usr/bin/echo $speed > /sys/devices/platform/i8042/serio1/serio2/sensitivity
    /usr/bin/echo $sensitivity > /sys/devices/platform/i8042/serio1/serio2/speed

  • Run custom systemd service before NetworkManager

    Hi, I am trying to write a systemd service that runs and completes before NetworkManager.service starts.
    I tried this:
    [Unit]
    Description=Custom service test
    Before=NetworkManager.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo Custom service test 1
    ExecStart=/usr/bin/sleep 5
    ExecStart=/usr/bin/echo Custom service test 2
    [Install]
    WantedBy=network.target
    While the custom service does start, I got this rather strange output:
    Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
    Jan 22 00:12:48 localhost kernel: NVRM: GPU at 0000:02:00: GPU-(snip)
    ... some unrelated messages (acpid, kdm, etc) ...
    Jan 22 00:12:49 localhost systemd-logind[1170]: Linked /tmp/.X11-unix/X0 to /run/user/1000/X11-display.
    Jan 22 00:13:13 localhost echo[1254]: Custom service test 2
    Jan 22 00:12:50 localhost systemd[1]: Started Custom service test.
    Jan 22 00:12:50 localhost systemd[1]: Starting Network Manager...
    As you can see, while everything appears in the expected order in the log, the timestamps look very wrong. The "Custom service test 2" says "00:13:13", yet it is in the middle of "00:12:49" and "00:12:50". What gives?
    Also, notice that the first echo was at 00:12:46, but NetworkManager started at 00:12:50, which is only 4 seconds later. The "sleep" in the custom services should have made it start at 00:12:51 at the earliest. I don't understand why things are not being respected.
    The output I'd expect to see is something like this:
    Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
    Jan 22 00:12:51 localhost echo[1254]: Custom service test 2
    Jan 22 00:12:51 localhost systemd[1]: Started Custom service test.
    Jan 22 00:12:51 localhost systemd[1]: Starting Network Manager...
    I have also made sure that it shows up in NetworkManager.service's After list:
    $ systemctl show -p After NetworkManager.service
    After=mycustomservice.service syslog.target systemd-journald.socket dbus.socket basic.target

    falconindy wrote:Sooooo this begs the question: what are you really trying to do?
    I'm trying to write a script that changes the interface's MAC address before NetworkManager gets a chance to take over the network interface. I'm aware that there's a page about exactly that on the wiki. I started with the systemd service from the bottom of the page, which says "Before=dhcpcd@%i.service". I changed that line to use "NetworkManager.service", and I changed the ExecStart line to "/usr/bin/macchanger -A myinterface" in order to get a random MAC address, instead of setting a fixed one like the example shows. Then I saw that macchanger's output was being mixed with NetworkManager's output in the journal, so I decided to try and write a custom service just for testing, making it start before NetworkManager, in order to see if it really was systemd's fault or if it was something macchanger-specific. Then I noticed the strange behavior described in the OP, didn't really know what to do about it, so I posted this topic. That's the story so far...
    Last edited by WindPower (2013-01-23 00:13:22)

  • How to make a systemd service for a bash script with pipes?

    I haven't been able to make a successful systemd service from this script.
    The script itself works (in terminal and xdg autostart), but systemd doesn't run anything after the first pipe (neither sed nor spd-say execute).
    Here's my service:
    [Unit]
    Description=Speak kernel and userspace messages
    [Service]
    Type=simple
    ExecStart=/usr/local/sbin/dmesg-speak
    [Install]
    WantedBy=multi-user.target
    Systemd says the script starts successfully, but only dmesg is started; it's output is not piped through sed or spd-say.
    I've also tried Type=forking without much success.
    Is there something I can do other than switching to sysv-init?
    Do I need IgnoreSIGPIPE=false?
    Last edited by quequotion (2015-02-12 17:07:21)

    fsckd wrote:The linked script appears to lack a hashbang. No hashbang = arbitrary interpretor.
    Yeah, that should probably be there. Since last post I've employed /usr/bin/bash in the service and added a hasbang, but sdp-say still does not run as a systemd service.
    I didn't test either option individually; the key seems to be finding an audio output accessible before user login. I am not certain:
    ccoffey wrote:If a pulseaudio session exists at all
    I am curious to try this:
    ccoffey wrote:run pulseaudio and dbus via XVFB.
    Setting DISPLAY as root would then allow you play audio.
    Still, it seems to me that ALSA would be available at some stage during boot, as is speech-dispatcher (for working with speakup!). If espeak were configured to play audio for root to ALSA, there would be a sound outlet for it (espeak can be used in pipeline mode without speech-dispatcher if need be), and pulseaudio would be probably be OK with that whenever it got around to starting (audio passed through alsa gets piped through, regardless of its source right?).
    I have tried the script with espeak instead of spd-say without success.
    Last edited by quequotion (2015-02-26 03:06:24)

  • Patch for /usr/bin/netcfg

    Hi all!
    I have submitted a bug report and made a patch for /usr/bin/netcfg, from initscripts-0.7.2-3.
    Now "netcfg --menu" works perfect with GPM enabled, so we can choose a different profile from a VC without shutting down GPM.
    Of course, "/etc/rc.d/network restart" (or start) will work too when having NET_PROFILES=(menu) in /etc/rc.conf - and executed from a VC.
    Hope it helps.
    You will find the patch and the bug report in the following link:
    http://bugs.archlinux.org/task/4916

    FANTASTIC!  Everyone who wants something add to Arch should take a leaf from your book - this is the way to get things done

  • /usr/bin/mail buggy or smtp server picky?

    I want to use mail to send email quickly from my terminal and decided to use msmtp as my smtp client to keep things light and straightforward.
    However, when I use /usr/bin/mail to send an email to [email protected], my smtp server (mail.messagingengine.com if you are interested) queues the email that was delivered by my /usr/bin/msmtp client fine (I get an OK for queue message), but after a couple of hours I get an NDR (Non Delivery Report) saying that my message couldn't be sent and will be retried until ultimately I get an NDR that my message couldn't be delivered.
    After some debugging, I realized that the reason the smtp server was having trouble is that my message didn't contain the From: header. Since the from address is already specified in the envelope upon SMTP-initiation, it seemed to me illogical that the smtp server couldn't just use that email.
    So I opened a ticket with those guys over at fastmail.fm, and they told me that the problem was not with the SMTP server, but with the mail client, which creates "invalid" messages (i.e. not sending the From: header). Since I trust my provider to know his stuff, here's my question:
    How can I tell /usr/bin/mail to insert a specific From: header?
    Thanks!

    Hello fukawi2,
    my ~/.mailrc contains one line:
    set sendmail=/usr/bin/msmtp
    Here's what happens when write an email using /usr/bin/mail from the mailx 8.1.1-7 package:
    [x@eee ~]$ mail [email protected]
    Subject: hello
    Another test
    EOT
    Here's how /usr/bin/mail passes my email to msmtp:
    /usr/bin/msmtp -i [email protected]
    To: [email protected]
    Subject: hello
    Another test
    Here's what my msmtp config looks like:
    #~/.msmtp
    account fastmail
    from "[email protected]"
    host mail.messagingengine.com
    auth on
    tls on
    tls_certcheck off
    user [email protected]
    password "*"
    logfile ~/msmtp.log
    Here's what the msmtp log shows when I send the email:
    nov 18 00:28:41 host=mail.messagingengine.com tls=on auth=on user=[email protected] from=[email protected] recipients=[email protected] mailsize=41 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as C3A00A7B7' exitcode=EX_OK
    I will send the NDR from the SMTP server when it arrives (takes a couple of hours) if you'd like to inspect it.
    Maybe ssmtp has a way to insert a From: header automatically, I haven't taken a look at it. Maybe even msmtp has a way to do that, even though I haven't found that option in the man pages.
    What I am trying to say is, if the /usr/bin/mail program cannot be configured to create a valid rfc-compliant email, then using an intermediary mail transport agent like ssmtp would only be a workaround but not a permanent fix. Hence my suggestion to replace mailx with a compliant, working package in the arch core install.
    Any ideas on how to proceed from here?
    Last edited by awayand (2009-11-17 23:37:45)

  • Using /usr/bin/mail

    I have some Perl scripts in which I would like to utilize /usr/bin/mail to send e-mail. I've tried using /usr/bin/mail from the command line to send a test message to my yahoo address, and it fails. I imagine this is pretty basic stuff for a Unix sysadmin, but all I've ever been is a user. What do I need to do to use /usr/bin/mail to send mail?
    Thanks,
    Brad

    the main thing you need is an open port 25. If it's open, then command line mail should work out of the box with no further preparation. it works on my work computer for example and I can send mail to my yahoo address from it.
    However, most internet providers block port 25. I suspect that's the case for you. then you need to set up mail to work with some external smtp server. I've never done it but it should be possible. see these links
    http://www.macosxhints.com/article.php?story=20081217161612647
    http://www.macosxhints.com/article.php?story=20050911184730802

  • Had deleted the /usr/bin, /usr/sbin directories of a node

    Dear All,
    I have ended up into deep trouble a few minutes ago: We have 2 node RHEL 6b-bit Oracle RAC.
    I had issued 'rm -rf /usr' command and in a few seconds i realised and then aborted the above process by issuing 'Ctrl-C'. I found following missing: bin, sbin, evolution28, remoteagent, java, include missing.
    As of now the Node and the Oracle database is working fine.
    Please let me know if I can copy the missing directories from the another node, as both the nodes are Identical (Just a wild guess).
    We do not have a backup of the RAC machines.
    Please help me on this.

    We had actually contacted our Network Admin to look into the issue, and things went worst when he copied the '/usr/bin' directory from one node to the other. The machine went to halt and rebooted with a blank screen.
    Moreover, we were unable to make any connections to the node, though the other node and the database are working fine.server halt... if you use linux (redhat) you can boot by CD or DVD (rescue), after boot from CD...
    You can mount disk and set up network ....
    So, You can copy /usr/bin/ + .... from another nodes to this server.
    As per my knowledge and experience, will it be fine if I format the machine and install Linux/Oracle freshly and then add this to the cluster?
    Should I unregister the old node from the cluster or let it remain as it is and follow the process of adding a new node.if you need to delete node and then add node, you can read from oracle documents
    http://download.oracle.com/docs/cd/B28359_01/rac.111/b28254/adddelunix.htm
    http://www.oracle.com/pls/db102/homepage

Maybe you are looking for

  • Why is my php form not sending to my e-mail?

    Here i have the code for my .php document and the code for my html. Why is the form not sending to my e-mail ([email protected])? At one point I had the form sending to my e-mail, but the information that was filled out was not appearing. Now no e

  • WHERE clause sources

    Hi, it is said that there are four WHERE clause sources: 1. WHERE clause block property (on datablock or programatically defined) 2. ONETIME_WHERE clause block property (on datablock) 3. Example Record 4. Query/Where dialog box I dont have any idea w

  • Illustrator file saves as blank jpeg

    HI everyone. I have a large illustrator file that I need to save as a jpeg for a table cloth printer. Every time I try to save the illustrator file as a jpeg the jpeg opens blank. Does any one know what might be going on? I've never seen this happen

  • Illustrator CC 2014 Crashing Frequently

    Illustrator CC 2014 keeps crashing whenever I save, open or relink files without any apparent reasons. It just stops working with a window prompting to close program. Sometimes I am able to open files and work on it without any problems or lag and wh

  • Is it possible to install software without the CD but with the product key

    I purchased a Mac Pro notebook whiile working out of town but do not have my Micro Office for Mac CD but I do have my product key. Any way to get it installed via internet with haviCD sent to me from home?