I created a service:
And I have two problems with it:
1) it creates empty pid file:
2) it doesn't send output to /dev/null:
What I'm doing wrong?
Bash:
#!/bin/sh
# PROVIDE: reklama
# REQUIRE: DAEMON
# KEYWORD: shutdown
. /etc/rc.subr
name="reklama"
rcvar=reklama_enable
start_cmd="${name}_start"
pidfile="/var/run/${name}.pid"
reklama_start()
{
/usr/local/bin/mpg123 -a /dev/dsp4.0 --loop -1 /usr/home/ishayahu/boroda/Vivaldi.mp3 & > /dev/null 2>&1
echo ${rc_pid} > ${pidfile}
}
load_rc_config $name
run_rc_command "$1"
And I have two problems with it:
1) it creates empty pid file:
Code:
root@012-music:/home/ishayahu # cat /var/run/reklama.pid
Code:
root@012-music:/home/ishayahu # service reklama onestart
root@012-music:/home/ishayahu # High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.29.3; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Directory: /usr/home/ishayahu/boroda/
Playing MPEG stream 1 of 1: Vivaldi.mp3 ...
MPEG 1.0 L III cbr128 44100 j-s
What I'm doing wrong?