I have a bash script in my
/usr/local/etc/rc.d/
that should run python script. I run the bush script with
service script_name start
and nothing happens at all. How could i debug that rc.d script? How could i know what is going on?
FreeBSD rc.d system expects /bin/sh scripts. Hence sh debugging techniques apply here. For example, printing the statements with 'set -x' and 'set -v'
shell> cat script.sh #!/bin/sh set -x set -v ...
Below is a simple example of how to start my_app with the service command
shell> cat /scratch/my_app #!/usr/local/bin/bash case $1 in start) echo "Start my_app" exit ;; stop) echo "Stop my_app" exit ;; esac
shell> cat /usr/local/etc/rc.d/my_app #!/bin/sh #set -x #set -v . /etc/rc.subr name="my_app" rcvar=my_app_enable load_rc_config $name start_cmd=${name}_start stop_cmd=${name}_stop my_app_start() { /scratch/my_app start } my_app_stop() { /scratch/my_app stop } run_rc_command "$1"
shell> grep my_app /etc/rc.conf my_app_enable="YES"
shell> service my_app start Start my_app
Details are available in
Also quoting from the doc
The manual pages rc(8), rc.subr(8), and rcorder(8) document the rc.d components in great detail. You cannot fully use the rc.d power without studying the manual pages and referring to them while writing your own scripts.
FreeBSD rc.d system expects /bin/sh scripts. Hence sh debugging techniques apply here. For example, printing the statements with 'set -x' and 'set -v'
Below is a simple example of how to start my_app with the service command
Details are available in
Also quoting from the doc