Update imapsync_cron.pl
Moved setting "is_running" status to just before the actual execution of imapsync command.
This commit is contained in:
		
							parent
							
								
									95fe217ce1
								
							
						
					
					
						commit
						f9cd9927b1
					
				| @ -93,10 +93,6 @@ while ($row = $sth->fetchrow_arrayref()) { | |||||||
|   $timeout1            = @$row[19]; |   $timeout1            = @$row[19]; | ||||||
|   $timeout2            = @$row[20]; |   $timeout2            = @$row[20]; | ||||||
| 
 | 
 | ||||||
|   $is_running = $dbh->prepare("UPDATE imapsync SET is_running = 1 WHERE id = ?"); |  | ||||||
|   $is_running->bind_param( 1, ${id} ); |  | ||||||
|   $is_running->execute(); |  | ||||||
| 
 |  | ||||||
|   if ($enc1 eq "TLS") { $enc1 = "--tls1"; } elsif ($enc1 eq "SSL") { $enc1 = "--ssl1"; } else { undef $enc1; } |   if ($enc1 eq "TLS") { $enc1 = "--tls1"; } elsif ($enc1 eq "SSL") { $enc1 = "--ssl1"; } else { undef $enc1; } | ||||||
| 
 | 
 | ||||||
|   my $template = $run_dir . '/imapsync.XXXXXXX'; |   my $template = $run_dir . '/imapsync.XXXXXXX'; | ||||||
| @ -134,6 +130,9 @@ while ($row = $sth->fetchrow_arrayref()) { | |||||||
|   ($custom_params eq "" ? () : ($command .= qq` ${custom_params}`)); |   ($custom_params eq "" ? () : ($command .= qq` ${custom_params}`)); | ||||||
| 
 | 
 | ||||||
|   try { |   try { | ||||||
|  |     $is_running = $dbh->prepare("UPDATE imapsync SET is_running = 1 WHERE id = ?"); | ||||||
|  |     $is_running->bind_param( 1, ${id} ); | ||||||
|  |     $is_running->execute(); | ||||||
|     my $stdout = `${command}` |     my $stdout = `${command}` | ||||||
|     $update = $dbh->prepare("UPDATE imapsync SET returned_text = ?, last_run = NOW(), is_running = 0 WHERE id = ?"); |     $update = $dbh->prepare("UPDATE imapsync SET returned_text = ?, last_run = NOW(), is_running = 0 WHERE id = ?"); | ||||||
|     $update->bind_param( 1, ${stdout} ); |     $update->bind_param( 1, ${stdout} ); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 hunter-nl
						hunter-nl