2015-04-10 22:01:51 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
2015-04-14 00:09:47 +00:00
|
|
|
source /mod/webif/lib/setup
|
2015-04-19 22:00:19 +00:00
|
|
|
require system.class settings.class lock
|
|
|
|
|
|
|
|
set loglevel [[settings] autolog]
|
2015-04-10 22:01:51 +00:00
|
|
|
|
2015-04-14 00:09:47 +00:00
|
|
|
set file [lindex $argv 0]
|
2015-04-10 22:01:51 +00:00
|
|
|
set dir [file dirname $file]
|
|
|
|
|
2015-04-19 22:00:19 +00:00
|
|
|
set prefix "autotrigger\[[pid]\]"
|
|
|
|
if {$loglevel > 0} { system plog auto "$prefix: will run for $dir" }
|
|
|
|
|
2015-04-14 00:09:47 +00:00
|
|
|
# Wait up to 10 minutes for any existing auto process to finish...
|
2015-04-19 22:00:19 +00:00
|
|
|
if {![acquire_lock webif_auto 600 5]} {
|
2015-04-14 00:09:47 +00:00
|
|
|
puts "Cannot acquire exclusive lock, terminating."
|
2015-04-19 22:00:19 +00:00
|
|
|
system plog auto "$prefix: failed to get lock"
|
2015-04-14 00:09:47 +00:00
|
|
|
exit
|
|
|
|
}
|
2015-04-19 22:00:19 +00:00
|
|
|
if {$loglevel > 0} { system plog auto "$prefix: got lock" }
|
|
|
|
|
|
|
|
exec /mod/webif/lib/bin/auto -prelocked -logprefix "$prefix: " -singledir $dir
|
2015-04-14 00:09:47 +00:00
|
|
|
|
2015-04-19 22:00:19 +00:00
|
|
|
if {$loglevel > 0} { system plog auto "$prefix: done" }
|
2015-04-10 22:01:51 +00:00
|
|
|
|