Artix Linux Forum

General Category => General Discussion => Topic started by: KoO-i3 on 03 October 2020, 20:24:14

Title: Re: [SOLVED]How to check service is running
Post by: KoO-i3 on 03 October 2020, 20:24:14
Have trouble with mpd and ncmpcpp and connection refused error. I would like to check that mpd service is running.

These commands don't work with Artix
Code: [Select]
sudo service --status-all

To start service
sudo service mpd start

To check status of service
sudo service mpd status

To stop service do
sudo service mpd stop

To relaod service (i.e. stop + start ) do
sudo service mpd reload

Thanks
Title: Re: How to check service is running
Post by: phoenix_king_rus on 03 October 2020, 20:39:01
The commands depend on init you use. For runit use sv check <service>
Title: Re: How to check service is running
Post by: ndowens on 03 October 2020, 21:18:57
Can also do
Code: [Select]
ps -aux | grep PROCESS-NAME
For example
Code: [Select]
ps -aux | grep mpd
Title: Re: How to check service is running
Post by: KoO-i3 on 04 October 2020, 03:28:13
Thanks for your replies

Running ( i3-gaps Artix 5.8.12-artix1-1 runit ) Dual booting with antiX-19.

Looks like their is no service setup for mpd-0.22-1 and I have no idea on how to do this anyway with an arch based system.
I start the service with other runit non systemd Linux namely antiX-19  with  exec --no-startup-id mpd and it works just fine.

sv status mpd
fail: mpd: unable to change to service directory: file does not exist

I have the same thing with hddtemp I need it run as normal user at startup so I can read my hard drives temps with my conkybar.
Yes know its a security risk.

Under Debian can use the below commands but they dont work with arch.

Code: [Select]
hddtemp with out sudo  
chmod u+s /etc/hddtemp.db
or
sudo dpkg-reconfigure hddtemp

Code: [Select]
"full_text": " SDA:${exec hddtemp /dev/sda -n --unit=C}° SDB:${exec hddtemp /dev/sdb -n --unit=C}° SDC:${exec hddtemp /dev/sdc -n --unit=C}° ",


This is now fixed just ran  ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Plus one other thing the time is out by two hours have tried a few things to change it to the right time but to no avail.

With antiX their is control center which runs scripts to change time from system to UTC or whatever.


ArtiX is a fine system very low on resources. I'm just not used to the arch way.

Thanks


Title: Re: How to check service is running
Post by: Artist on 04 October 2020, 09:53:07
about error: fail: mpd: unable to change to service directory: file does not exist

did you run: pacman -S mpd-runit
and: ln -s /etc/runit/sv/mpd /run/runit/service/
Title: Re: How to check service is running
Post by: KoO-i3 on 05 October 2020, 00:48:06
about error: fail: mpd: unable to change to service directory: file does not exist

did you run: pacman -S mpd-runit
and: ln -s /etc/runit/sv/mpd /run/runit/service/

Last night I reinstalled Artix  and installed the runit version of mpd and added the link.

This morning after checking the service the service is not starting.  Is their somewhere I need to add the service to run at startup?
Or maybe add a run level with ln -s /etc/runit/sv/service /etc/runit/runsvdir/runlevel@@ ?
https://wiki.artixlinux.org/Main/Runit (https://wiki.artixlinux.org/Main/Runit)

Code: [Select]
Artix * 7 files = 268K ~ >$sudo sv check mpd
ok: down: mpd: 0s, normally up, want up
Artix * 7 files = 268K ~ >$sudo sv up mpd
 Artix * 7 files = 308K ~ >$sudo sv check mpd
ok: down: mpd: 1s, normally up, want up
Artix * 7 files = 312K ~ >$sudo sv restart mpd
ok: run: mpd: (pid 20798) 0s

Then after rebooting
sudo sv status mpd
down: mpd: 1s, normally up, want up

Thanks for your help and time.
Title: Re: How to check service is running
Post by: calvinh on 05 October 2020, 03:45:48
I am also running runit. Just tested mpd and didn't see any problem at all.

Code: [Select]
sudo pacman -S mpd mpd-runit 

Code: [Select]
sudo ln -s /etc/runit/sv/mpd /run/runit/service

Code: [Select]
sudo sv status mpd
run: mpd: (pid 5645) 473s

Code: [Select]
ps -ef | grep mpd
root      5644   898  0 21:34 ?        00:00:00 runsv mpd
root      5645  5644  0 21:34 ?        00:00:00 mpd --no-daemon

Without logs, we don't know what went wrong in your system. Maybe check /var/log/*.log for a clue?
Title: Re: How to check service is running [Solved]
Post by: KoO-i3 on 05 October 2020, 08:48:24
I fix the service by commenting out this line in my i3.config #exec --no-startup-id mpd
The error was starting the service twice.

Code: [Select]
ps -ef | grep mpd
root      1115   983  0 16:35 ?        00:00:00 runsv mpd
root      1127  1115  0 16:35 ?        00:00:00 mpd --no-daemon
koo       1235     1  0 16:35 ?        00:00:00 bash /home/koo/.scripts/mpd-notify.sh
koo       2528  2409  0 16:37 pts/1    00:00:00 grep --color=auto mpd

Code: [Select]
$sudo sv status mpd
 run: mpd: (pid 1127) 100s

Thanks all for your help.