|
|
@ -13,73 +13,74 @@ start_instance() { |
|
|
|
local conffile="$CONFPFX-$conf.conf" |
|
|
|
|
|
|
|
config_get_bool item "$conf" enabled 0 |
|
|
|
[ $item = 0 ] && return |
|
|
|
[ "$item" = 0 ] && return |
|
|
|
|
|
|
|
echo -e "; don't edit. instead look into /etc/config/gammu\n[gammu]\n" > $conffile |
|
|
|
{ |
|
|
|
printf "; don't edit. instead look into /etc/config/gammu\n[gammu]\n\n" |
|
|
|
|
|
|
|
config_get item "$conf" device |
|
|
|
[ -z "$item" ] && return |
|
|
|
echo "device = $item" >> $conffile |
|
|
|
echo "device = $item" |
|
|
|
|
|
|
|
config_get item "$conf" connection |
|
|
|
[ -z "$item" ] && return |
|
|
|
echo "connection = $item" >> $conffile |
|
|
|
echo "connection = $item" |
|
|
|
|
|
|
|
config_get item "$conf" logfile |
|
|
|
[ -z "$item" ] && item=syslog |
|
|
|
echo "logfile = $item" >> $conffile |
|
|
|
echo "logfile = $item" |
|
|
|
|
|
|
|
echo -e "\n[smsd]\nphoneid = $conf\nservice = files\nlogfile = $item" >> $conffile |
|
|
|
echo -e "checkbattery = 0\nhangupcalls = 1" >> $conffile |
|
|
|
printf "\n[smsd]\nphoneid = %s\nservice = files\nlogfile = %s\n" "$conf" "$item" |
|
|
|
printf "checkbattery = 0\nhangupcalls = 1\n" |
|
|
|
|
|
|
|
config_get item "$conf" pin |
|
|
|
[ -n "$item" ] && echo "pin = $item" >> $conffile |
|
|
|
|
|
|
|
[ -n "$item" ] && echo "pin = $item" |
|
|
|
config_get item "$conf" phonecode |
|
|
|
[ -n "$item" ] && echo "phonecode = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "phonecode = $item" |
|
|
|
|
|
|
|
config_get item "$conf" send |
|
|
|
[ -n "$item" ] && echo "send = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "send = $item" |
|
|
|
|
|
|
|
config_get item "$conf" receive |
|
|
|
[ -n "$item" ] && echo "receive = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "receive = $item" |
|
|
|
|
|
|
|
config_get item "$conf" timeout |
|
|
|
[ -n "$item" ] && echo "commtimeout = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "commtimeout = $item" |
|
|
|
|
|
|
|
config_get item "$conf" sleep |
|
|
|
[ -n "$item" ] && echo "loopsleep = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "loopsleep = $item" |
|
|
|
|
|
|
|
config_get item "$conf" report |
|
|
|
[ -n "$item" ] && echo "deliveryreport = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "deliveryreport = $item" |
|
|
|
|
|
|
|
config_get item "$conf" onreceive |
|
|
|
[ -n "$item" ] && echo "runonreceive = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "runonreceive = $item" |
|
|
|
|
|
|
|
config_get item "$conf" onerror |
|
|
|
[ -n "$item" ] && echo "runonfailure = $item" >> $conffile |
|
|
|
[ -n "$item" ] && echo "runonfailure = $item" |
|
|
|
|
|
|
|
config_get item "$conf" spool |
|
|
|
[ -z "$item" ] && item=/var/sms |
|
|
|
[ ! -d $item ] && { |
|
|
|
mkdir $item |
|
|
|
mkdir $item/inbox |
|
|
|
mkdir $item/outbox |
|
|
|
mkdir $item/sent |
|
|
|
mkdir $item/error |
|
|
|
[ -d "$item" ] || { |
|
|
|
mkdir "$item" |
|
|
|
mkdir "$item/inbox" |
|
|
|
mkdir "$item/outbox" |
|
|
|
mkdir "$item/sent" |
|
|
|
mkdir "$item/error" |
|
|
|
} |
|
|
|
echo -e "inboxpath = $item/inbox/\noutboxpath = $item/outbox/" >> $conffile |
|
|
|
echo -e "sentsmspath = $item/sent/\nerrorsmspath = $item/error/" >> $conffile |
|
|
|
printf "inboxpath = %s/inbox/\noutboxpath = %s/outbox/\n" "$item" "$item" |
|
|
|
printf "sentsmspath = %s/sent/\nerrorsmspath = %s/error/\n" "$item" "$item" |
|
|
|
} > "$conffile" |
|
|
|
|
|
|
|
config_get item "$conf" allow |
|
|
|
[ -n "$item" ] && { |
|
|
|
local data |
|
|
|
local allowfile=$CONFPFX-$conf.allow |
|
|
|
for data in $item ; do |
|
|
|
echo $data >> $allowfile |
|
|
|
echo $data >> "$allowfile" |
|
|
|
done |
|
|
|
|
|
|
|
echo "includenumbersfile = $allowfile" >> $conffile |
|
|
|
echo "includenumbersfile = $allowfile" >> "$conffile" |
|
|
|
} |
|
|
|
|
|
|
|
config_get item "$conf" deny |
|
|
@ -87,18 +88,18 @@ start_instance() { |
|
|
|
local data |
|
|
|
local denyfile=$CONFPFX-$conf.deny |
|
|
|
for data in $item ; do |
|
|
|
echo $data >> $denyfile |
|
|
|
echo $data >> "$denyfile" |
|
|
|
done |
|
|
|
|
|
|
|
echo "excludenumbersfile = $denyfile" >> $conffile |
|
|
|
echo "excludenumbersfile = $denyfile" >> "$conffile" |
|
|
|
} |
|
|
|
|
|
|
|
procd_open_instance |
|
|
|
|
|
|
|
config_get_bool item "$conf" respawn 0 |
|
|
|
[ $item != 0 ] && procd_set_param respawn |
|
|
|
[ "$item" = 0 ] || procd_set_param respawn |
|
|
|
|
|
|
|
procd_set_param command $PROG --config=$conffile |
|
|
|
procd_set_param command $PROG --config="$conffile" |
|
|
|
|
|
|
|
config_get item "$conf" pidfile |
|
|
|
[ -n "$item" ] && procd_append_param command --pid=$item |
|
|
|