Starting mpc via systemd service

Ask questions about Arch Linux ARM. Please search before making a new topic.

Starting mpc via systemd service

Postby chicki » Thu Aug 01, 2013 9:51 am

Hello world,

sorry for starting a new topic, but this seems rather unrelated to my other (solved) problem.
ight now I am stuck getting MPC to auto load a playlist and play it upon start up.
I have tried loading a shell script in a service
$this->bbcode_second_pass_code('', '
mpc load Radio.m3u && mpc play')

as well as running the command from within the service file:
$this->bbcode_second_pass_code('', '[Unit]
Description=Load Playlist and play it
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/mpc load Radio.m3u
User=root

[Install]
WantedBy=multi-user.target
')

Can someone please help me with the .service file?
chicki
 
Posts: 7
Joined: Wed Jul 31, 2013 12:50 pm

Re: Starting mpc via systemd service

Postby WarheadsSE » Thu Aug 01, 2013 2:33 pm

probably want that to be After=mpd.service
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Starting mpc via systemd service

Postby chicki » Thu Aug 01, 2013 3:03 pm

Thanks for the help!
I am still getting the following error:
$this->bbcode_second_pass_code('', 'systemctl status start-mpc
start-mpc.service - Load Playlist and play it
Loaded: loaded (/usr/lib/systemd/system/start-mpc.service; enabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:07 CET; 43 years 6 months ago
Process: 120 ExecStart=/usr/bin/mpc load Radio.m3u (code=exited, status=1/FAILURE)
')
chicki
 
Posts: 7
Joined: Wed Jul 31, 2013 12:50 pm

Re: Starting mpc via systemd service

Postby WarheadsSE » Thu Aug 01, 2013 3:53 pm

That's not the error... thats the status of error... what is the result of the actual error? (journalctl)
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Starting mpc via systemd service

Postby chicki » Thu Aug 01, 2013 4:41 pm

hmm it doesn't seem to be running :(

$this->bbcode_second_pass_code('', '# journalctl
No journal files were found.
')
chicki
 
Posts: 7
Joined: Wed Jul 31, 2013 12:50 pm

Re: Starting mpc via systemd service

Postby WarheadsSE » Thu Aug 01, 2013 5:02 pm

Trust me it is running.

Man journalctl
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Starting mpc via systemd service

Postby chicki » Fri Aug 02, 2013 7:35 am

well I still can't get journalctl to show me any entries (read the man page, tried -b, -n, -f etc.), but atleast I found out that the service starts correctly if I start it manually after boot.
Hence I would assume that using After=mpd.service is still too early?!

Edit: also tried Type=idle - didn't work either :(
chicki
 
Posts: 7
Joined: Wed Jul 31, 2013 12:50 pm

Re: Starting mpc via systemd service

Postby chicki » Sun Aug 04, 2013 1:02 pm

Ok, using a service was probably the wrong idea anyway (atleast for my purpose, unless you want to start the device always playing the same song)...
Using the state file of mpd is the smarter way, I just had to create the state file and chmod it...
chicki
 
Posts: 7
Joined: Wed Jul 31, 2013 12:50 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 5 guests