move plugins, fix cron, add queue upgrade

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3470 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2017-01-05 22:58:05 +00:00
parent d58ebd684a
commit 0dd9641e76
17 changed files with 36 additions and 6 deletions

View File

@ -18,9 +18,11 @@ export tmpf=/tmp/cronf.$$
crontab=$PKG_ROOT/bin/crontab
if [ -x $crontab ]; then
$crontab -l | grep -v webif/lib/bin/auto > $tmpf
$crontab -l | grep -v webif/lib/bin/auto \
| grep -v webif/lib/auto > $tmpf
cat $tmpf - << EOM | $crontab -
* * * * * /mod/webif/lib/bin/auto >/dev/null 2>&1
* * * * * /mod/webif/lib/auto/scan >/dev/null 2>&1
* * * * * /mod/webif/lib/auto/deq >/dev/null 2>&1
EOM
fi
@ -47,6 +49,7 @@ $PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
#fi
/mod/webif/lib/bin/diskattrs
/mod/webif/lib/auto/upgrade
#/mod/webif/lib/bin/resetnew
# Remove hook script placed by the legacy rt3070 package which does not work

View File

@ -4,7 +4,8 @@ export tmpf=/tmp/cronf.$$
crontab=$PKG_ROOT/bin/crontab
if [ -x $crontab ]; then
$crontab -l | grep -v webif/lib/bin/auto > $tmpf
$crontab -l | grep -v webif/lib/bin/auto \
| grep -v webif/lib/auto > $tmpf
[ -s $tmpf ] && $crontab $tmpf || $crontab -r
fi

View File

@ -1,6 +1,6 @@
Everything is a plugin. Those bundled with the web interface are in
/mod/webif/lib/auto/<name> and others are in /mod/webif/plugin/<name>
/mod/webif/lib/auto/plugin/<name> and others are in /mod/webif/plugin/<name>
----------------------------------------------------------------------
Priorities (* - additional package)

View File

@ -98,7 +98,7 @@ proc ::auto::register {plugin {priority 500}} {
# Load plugins
# Bundled
eval_plugins queue 1 "" /mod/webif/lib/auto
eval_plugins queue 1 "" /mod/webif/lib/auto/plugin
# Third party

View File

@ -273,7 +273,7 @@ proc register {type fn {priority 50}} {
# Load plugins
# Bundled
eval_plugins auto 1 "" /mod/webif/lib/auto
eval_plugins auto 1 "" /mod/webif/lib/auto/plugin
# Third party

11
webif/lib/auto/upgrade Executable file
View File

@ -0,0 +1,11 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require queue.class
if {[queue version] == 1} {
queue dbhandle -close
file delete /mod/etc/queue.db
queue dbhandle
}

View File

@ -219,6 +219,21 @@ proc {queue size} {} {
return [llength [queue runcandidates]]
}
proc {queue version} {} {
set db [queue dbhandle]
set version 1
catch {
foreach row [$db query {
select val from config
where var = 'version'
}] {
lassign $row x version
}
}
return $version
}
queue method update {_status {_log ""} {_retries 0} {_runtime 0}} {
set db [queue dbhandle]
$db query {