Hi, for the purposes of learning mainly, I'm trying to do things the hard way and set up my TellStick Duo on Arch Linux on a Raspberry Pi. I've got it all compiled fine, but I can't figure out how to run (and set up to auto run) the telldusd daemon using the new systemd service handling that Arch has shifted to.
Any help appreciated.
Arch Linux service installation
Moderator: Telldus
Re: Arch Linux service installation
Hi,
You know there is a package in AUR, i.e. telldus-core.
From that package I have /etc/rc.d/telldusd that can be used in rc.conf to autostart.
Anyway the "hard" way:
You know there is a package in AUR, i.e. telldus-core.
From that package I have /etc/rc.d/telldusd that can be used in rc.conf to autostart.
Anyway the "hard" way:
Code: Select all
#!/bin/bash
daemon_name=telldusd
. /etc/rc.conf
. /etc/rc.d/functions
get_pid() {
pidof -o %PPID $daemon_name
}
case "$1" in
start)
stat_busy "Starting $daemon_name daemon"
PID=$(get_pid)
if [ -z "$PID" ]; then
[ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
# RUN
$daemon_name &
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
echo $(get_pid) > /var/run/$daemon_name.pid
add_daemon $daemon_name
stat_done
fi
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping $daemon_name daemon"
PID=$(get_pid)
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
rm -f /var/run/$daemon_name.pid &> /dev/null
rm_daemon $daemon_name
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
status)
stat_busy "Checking $daemon_name status";
ck_status $daemon_name
;;
*)
echo "usage: $0 {start|stop|restart|status}"
esac
exit 0
Re: Arch Linux service installation
Hi,
sorry missed the systemd part.
I have converted my old Arch installation to systemd a week ago and made this service:
/etc/systemd/system/telldus.service
It is working for me, but this was also the first systemd service file I attempted to write....
sorry missed the systemd part.
I have converted my old Arch installation to systemd a week ago and made this service:
/etc/systemd/system/telldus.service
Code: Select all
# Telldusd service unit file
#
[Unit]
Description=Telldus-core service telldusd
After=syslog.target network.target
[Service]
Type=forking
#User=
#Clean up
#ExecStartPre=rm /var/run/telldusd.pid
ExecStart=/usr/sbin/telldusd
ExecStop=/bin/kill -HUP $MAINPID
PIDFile=/var/run/tellddusd.pid
KillMode=process
[Install]
WantedBy=multi-user.target
Re: Arch Linux service installation
Nice post-----------
Try out our free Pass4sure 300-206 training courses to get high flying success in final MICROSOFT exams .