Open eri451 opened 12 years ago
You could use an alias. ~/.bashrc
alias mocp='python3 /<path_where_script_is>/mocp-scrobbler.py -d ; mocp'
Using this method causes mocp-scrobbler to kill itself and restart again after executing mocp.
$ mocp-scrobbler.py -d
Pidfile found! Attempting to kill existing scrobbler process...
Scrobbler daemon started with pid 6009
Why does this happen? Is there a way to prevent this?
Best way is to create your own init script. This will start script on system startup and kill it on shutdown. With this solution you can relogin without killing neither moc nor moc-latfm.
For openrc it would be (just remember to change YOUR_USERNAME with your account username where moc is bein run)
#!/sbin/openrc-run
start() {
ebegin "Starting mocp-lastfm"
start-stop-daemon \
--start \
--make-pidfile \
--pidfile /var/run/mocp-lastfm.pid \
--background \
--user YOUR_USERNAME \
--name mocp-lastfm \
--exec mocp-scrobbler.py -q
eend $?
}
stop() {
ebegin "Stopping mocp-lastfm"
start-stop-daemon --stop --signal 15 \
--pidfile /var/run/mocp-lastfm.pid
eend $?
}
of cause with -d an just once .. but how?