title: Laravel scheduled task (withoutOverlapping) not deleting file in storage
body: <p>Some of my scheduled tasks haven't been running when using Laravel</p>
  
  <p>This is because they've been set to run:</p>
  
  <pre><code>-&gt;withoutOverlapping()
  </code></pre>
  
  <p>More can be read about this here: <a href="https://laravel.com/docs/master/scheduling" rel="nofollow">https://laravel.com/docs/master/scheduling</a></p>
  
  <p>When this is used a file is put in storage when it starts running and removed when it's done and there is a check for the existence of the file when it tries to run, if it exists it won't run again.</p>
  
  <p>Clearly if the file is still there and preventing the command from running some sort of error caused the application to exit before the file was removed.</p>
  
  <p>However the file is simply named an md5 hash. Of what i'm not 100% sure. It's created using the mutexPath() function in Illuminate/Console/Scheduling/Event.php</p>
  
  <pre><code>public function mutexPath()
  {
      return storage_path('framework/schedule-'.md5($this-&gt;expression.$this-&gt;command));
  }
  </code></pre>
  
  <p>Exactly what $this->expression and $this->command are isn't obvious since they're created throughout a range of files and classes which i've been trying to follow for a few hours with very little luck.</p>
  
  <p>What i'd like is for some way to scandir the storage/framework dir and remove any old cache files. This is simple enough, but isn't helpful long term. What I then need to do is figure out which command the old cache file in storage is related to so that I can debug which ones aren't being deleted and why.</p>
  
  <p>Preferably this would involve some way of looping through all the scheduled commands in App/Console/Kernel.php and listing which ones have an overlap file listed and which don't.</p>
  
  <p>But I have no idea how to do this because it's obfuscated in different classes and many of the functions appear to be protected or private, preventing a simple loop through of all the scheduled tasks.</p>
  
  <p>Has anyone encountered that before? Is there any way to get the cache filename (from the mutexPath() function) to do an easy file_exists() check? What's the best way of managing whether these non overlapping scheduled tasks are actually running and not being perpetually blocked by an old file that wasn't deleted?</p>