|
#!/bin/sh /etc/rc.common
|
|
# Oct 2012, karlp@remake.is
|
|
START=90
|
|
APP=pagekitec
|
|
USE_PROCD=1
|
|
|
|
add_instance() {
|
|
local cfg="$1"
|
|
local kitename kitesecret simple_http simple_ssh simple_ws static
|
|
config_get kitename "$cfg" kitename
|
|
config_get kitesecret "$cfg" kitesecret
|
|
[ -z "$kitename" -o -z "$kitesecret" ] && {
|
|
echo "Both kitename and kitesecret must be specified"
|
|
return 1
|
|
}
|
|
config_get_bool simple_http "$cfg" simple_http 0
|
|
config_get_bool simple_ssh "$cfg" simple_ssh 0
|
|
config_get simple_ws "$cfg" simple_ws 0
|
|
config_get_bool static "$cfg" static 0
|
|
|
|
procd_open_instance
|
|
procd_set_param command $APP
|
|
procd_append_param command -s
|
|
procd_append_param command -Y json:/tmp/pagekite.status.json
|
|
[ $static -eq 1 ] && procd_append_param command -S
|
|
[ $simple_http -eq 1 ] && procd_append_param command 80 http $kitename 0 $kitesecret
|
|
[ $simple_ssh -eq 1 ] && procd_append_param command 22 raw-22 $kitename 0 $kitesecret
|
|
[ $simple_ws -gt 0 ] && procd_append_param command $simple_ws websocket-$simple_ws $kitename 0 $kitesecret
|
|
procd_close_instance
|
|
}
|
|
|
|
start_service() {
|
|
config_load pagekitec && config_foreach add_instance pagekitec
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
procd_add_reload_trigger "pagekitec"
|
|
}
|