Skip to content

Commit

Permalink
utils/kamctl: allow the definition of a specific startup file at star…
Browse files Browse the repository at this point in the history
…t process

- Added the possibility to specify an alternative file different from the default: kamailio.cfg, when starting kamailio, using the kamctl tool.
This makes it possible to start kamailio by passing a startup file located in a specific folder (via ETCDIR env variable) and with a specific name, instead of using the default name: kamailio.cfg.
  • Loading branch information
bundasmanu authored and miconda committed Mar 10, 2023
1 parent b15db86 commit e3b8b76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/kamctl/kamctl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ if [ -z "$MYLIBDIR" ] ; then
fi
fi

if [ -z "$STARTUP_CONFIG_FILE" ]; then
STARTUP_CONFIG_FILE="kamailio.cfg"
fi

##### ------------------------------------------------ #####
### load base functions
#
Expand Down Expand Up @@ -2007,9 +2011,9 @@ kamailio_start() {
exit 1
fi
if [ $SYSLOG = 1 ] ; then
$KAMBIN -P $PID_FILE -f $ETCDIR/kamailio.cfg $STARTOPTIONS 1>/dev/null 2>/dev/null
$KAMBIN -P $PID_FILE -f $ETCDIR/$STARTUP_CONFIG_FILE $STARTOPTIONS 1>/dev/null 2>/dev/null
else
$KAMBIN -P $PID_FILE -E -f $ETCDIR/kamailio.cfg $STARTOPTIONS
$KAMBIN -P $PID_FILE -E -f $ETCDIR/$STARTUP_CONFIG_FILE $STARTOPTIONS
fi
sleep 3
if [ ! -s $PID_FILE ] ; then
Expand Down
4 changes: 4 additions & 0 deletions utils/kamctl/kamctlrc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
## PID file path - default is: /run/kamailio/kamailio.pid
# PID_FILE=/run/kamailio/kamailio.pid

## Kamailio Startup Configuration File
## Default is: kamailio.cfg
# STARTUP_CONFIG_FILE=kamailio.cfg

## Extra start options - default is: not set
## example: start Kamailio with 64MB shared memory: STARTOPTIONS="-m 64"
# STARTOPTIONS=

0 comments on commit e3b8b76

Please sign in to comment.