You are not logged in.
Hi, I am trying to make a service file to execute "devmon --no-mount --exec-on-audio abcde". Basicly I want abcde to run when an audio cd is inserted into a headless computer. I have tried some udev rules but had no luck with that.
I then found udevil and devmon, and it seems to do exectly what I want.
So Ive made a systemd service file and put it in to /usr/lib/systemd/system
here is it:
/usr/lib/systemd/system/abcde-auto.service
[Unit]
Description=Virtual Distributed Ethernet
[Service]
Type=simple
ExecStart=/usr/bin/devmon --no-mount --exec-on-audio abcde
[Install]
WantedBy=multi-user.targetI have started this with
systemctl start abcde-auto.serviceand I see that a devmon process has started with the same arguments I gave in the service file, so all is good.
But now, I am not too sure about the "Type" in the service file, devmon starts abcde, but:
systemctl stop abcde-auto.servicedoes not stop abcde, only devmon.
Is there a way to setup the service file so that abcde will end as well as devmon?
*Edit
Ive read this http://www.freedesktop.org/software/sys … rvice.html but Im still not too sure. Dont really know what most of it means.
Last edited by jrussell (2012-10-20 18:09:23)
bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U
Offline
I can't help you with service, but devmon should be started in .xinitrc or your startup script.
Offline
I can't help you with service, but devmon should be started in .xinitrc or your startup script.
no user logs on to the computer so .xinitrc wont help (I dont think?), what startup script are you refering to?
bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U
Offline
I'm sorry, I didn't see that headless part.
You could use ExecStop= to kill abcde.
Last edited by Šaran (2012-10-20 18:21:39)
Offline
I'm sorry, I didn't see that headless part.
You could use ExecStop= to kill abcde.
Ill give that a try, thanks
bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U
Offline
I use type 'oneshot' and add an ExecStop= to start and stop scripts.
Like here is the unit file I use to start and stop arno-iptables-firewall
[Unit]
Description=Arno iptables firewall
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/arno-iptables-firewall start
ExecStop=/usr/sbin/arno-iptables-firewall stop
[Install]
WantedBy=multi-user.targetOpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec
Offline
Hello jrussel,
what did your service became then after all? I'm busy with making a headless music server and want to do auto-ripping also when inserting an audio-cd. It didn't work out also to use udev rules for that.
I want to go the udevil/devmon way.
Thanks in advance!
Offline
maybe there's a more elegant way, but this works:
ExecStop=/usr/bin/killall abcdeOffline