Advertisement
Guest User

CrazyTux

a guest
Apr 27th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. # freeswitch
  2. description "freeswitch sip daemon"
  3.  
  4. # runlevel / dependencies
  5. start on (filesystem and net-device-up IFACE=lo)
  6. stop on runlevel [!2345]
  7.  
  8. # set daemon path
  9. env DAEMON="/usr/local/freeswitch-1.4/bin/freeswitch"
  10.  
  11. # set run flags
  12. env FLAGS="-nc -nonatmap"
  13.  
  14. # set pid path
  15. env PID="/var/run/freeswitch.pid"
  16.  
  17. # run as user
  18. env USER=root
  19.  
  20. # run as group
  21. env GROUP=root
  22.  
  23. # set configuration directory
  24. env CONFIG_DIR="/home/user/resources/freeswitch/conf"
  25.  
  26. # set log directory
  27. env LOG_DIR="/home/user/resources/freeswitch/logs"
  28.  
  29. # set temporary filedirectory
  30. env TEMP_DIR="/home/user/resources/freeswitch/tmp"
  31.  
  32. # set cache directory
  33. env CACHE_DIR="/home/user/ramdisk"
  34.  
  35. # set cache directory size
  36. env CACHE_DIR_SIZE="1024m"
  37.  
  38. # set sqlite database directory
  39. env DB_DIR="/home/user/resources/freeswitch/db"
  40.  
  41. # set run directory
  42. env RUN_DIR="/home/user/resources/freeswitch/run"
  43.  
  44. # expect daemon
  45. expect daemon
  46.  
  47. # automatically respond on crash / core dump
  48. respawn
  49.  
  50. # limit respawn threshold
  51. respawn limit 10 5
  52.  
  53. # set stack size - do not uncomment below line as it causes some weird "argument list too long" error, no idea why atm...
  54. #limit stack 240 240
  55.  
  56. # set open file limit
  57. limit nofile 250000 250000
  58.  
  59. # set umask
  60. umask 022
  61.  
  62. pre-start script
  63. # create configuration directory
  64. [ -d $CONFIG_DIR ] || mkdir $CONFIG_DIR
  65.  
  66. # create log directory
  67. [ -d $LOG_DIR ] || mkdir $LOG_DIR
  68.  
  69. # create temp file directory
  70. [ -d $TEMP_DIR ] || mkdir $TEMP_DIR
  71.  
  72. # create cache file directory
  73. [ -d $CACHE_DIR ] || mkdir $CACHE_DIR
  74.  
  75. # check for mountpoint / mounted ramdisk on $CACHE_DIR, otherwise create one
  76. mountpoint -q $CACHE_DIR || mount -t tmpfs -o size=$CACHE_DIR_SIZE tmpfs $CACHE_DIR
  77.  
  78. # create flatfile / SQLite database directory
  79. [ -d $DB_DIR ] || mkdir $DB_DIR
  80.  
  81. # create freeswitch run directory
  82. [ -d $RUN_DIR ] || mkdir $RUN_DIR
  83.  
  84. # chown and reset directory permissions
  85. # i've tried a million different combo's of things here.... to try and get it working but these lines below cause it to fail.
  86. #for FSDIR in "$CONFIG_DIR" "$LOG_DIR" "$TEMP_DIR" "$CACHE_DIR" "$CACHE_DIR_SIZE" "$DB_DIR" "$RUN_DIR"
  87. #for FSDIR in "$CONFIG_DIR" "$LOG_DIR" "$TEMP_DIR" "$CACHE_DIR" "$CACHE_DIR_SIZE" "$DB_DIR" "$RUN_DIR"
  88. # chown -R ${USER}:${GROUP} $FSDIR
  89. #done
  90. end script
  91.  
  92. script
  93. exec $DAEMON -u $USER -g $GROUP -conf $CONFIG_DIR -log $LOG_DIR -temp $TEMP_DIR -cache $CACHE_DIR -db $DB_DIR -run $RUN_DIR $FLAGS
  94. end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement