Replacing rc.local with systemd .service file

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

Replacing rc.local with systemd .service file

Postby grayman4hire » Tue Nov 27, 2012 1:01 am

Hello,

I have the following in my rc.local file to startup ShairPort on bootup:

$this->bbcode_second_pass_code('', '
shairport -a PogoPlay -b 256 -d
')

I need to replace this with a systemd .service file and need a little help.

I created the following shairport.service file under /etc/systemd/system:
$this->bbcode_second_pass_code('', '
[root@pogoplay4 system]# pwd
/etc/systemd/system
[root@pogoplay4 system]# cat shairport.service
[Unit]
Description=Startup ShairPort (Apple AirPlay)
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/shairport -a PogoPlay -b 256 -d
ExecStop=/usr/bin/killall shairport


[Install]
WantedBy=multi-user.target
[root@pogoplay4 system]#

')

Does that look right? It doesn't look like its starting properly.

$this->bbcode_second_pass_code('', '
[root@pogoplay4 system]# /usr/local/bin/shairport -a PogoPlay -b 256 -d
[root@pogoplay4 system]# killall shairport
[root@pogoplay4 system]# systemctl start shairport.service
[root@pogoplay4 system]# killall shairport
shairport: no process found
[root@pogoplay4 system]#
')
grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA

Re: Replacing rc.local with systemd .service file

Postby WarheadsSE » Tue Nov 27, 2012 2:32 am

Change to forking or simple
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA

Re: Replacing rc.local with systemd .service file

Postby moonman » Wed Nov 28, 2012 2:46 am

Try oneshot and add " RemainAfterExit=yes" after execstop
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Replacing rc.local with systemd .service file

Postby grayman4hire » Sat Dec 01, 2012 12:33 am

$this->bbcode_second_pass_quote('moonman', 'T')ry oneshot and add " RemainAfterExit=yes" after execstop


Thank you @moonman!!! That worked.

Here is what I'm using for future reference.
$this->bbcode_second_pass_code('', '
[Unit]
Description=Startup ShairPort (Apple AirPlay)
After=network.target
After=avahi-daemon.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/shairport -a PogoPlay -b 256 -d
ExecStop=/usr/bin/killall shairport
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
')
grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 8 guests