Automatic Update Script (Major Update)

If you’re using my automatic update script, you might find this new version useful. As always, the script is located at

However, please be sure you go over the README at

So what’s the new functionality? In short, it should now be completely hands-off provided everything is setup correctly. You shouldn’t have to edit any lines whatsoever, and it should “just work.” And as of Invoice Ninja v4.3.0, it will attempt to delete /bootstrap/cache/compiled.php if it exists (I’ll leave this in for users who may not be on the absolute latest releases and want to update later).

While I go over this next part in the README, it’s important that you know what assumptions are being made and what the caveats are.

  1. You have locate installed. If not, you'll want to do so. sudo apt install locate
  2. You have only ONE copy of the Invoice Ninja directory structure on your system (explained below).
  3. You have sudo access, either to run the script manually, or to run it as a cron task.
  4. The partition containing /usr/local/ has enough space to store the downloaded ZIP file, as well as to extract the files prior to having them synced to your install folder.

So what are the caveats?

For starters, the script uses locate to search for a specific composer.json that resides in the Invoice Ninja root directory. This is how it knows where you have IN installed. If there are other copies installed on the same system (or even just the files extracted somewhere), locate will return multiple paths, and cause problems. That’s another reason to be 100% sure you have full read/write access to the /usr/local/ folder, as we want to make sure the script removes the extracted files when it’s done with them. Also, the script will run sudo updatedb before locate to make sure the path returned is the most up to date. This could take a few seconds on some systems if it hasn’t been run in a while. If you’re running it as a daily cron task, this shouldn’t be an issue, however.

The script will detect whether or not you’re using UPDATE_SECRET in your .env file, and pass the proper URL to wget with the string you set. However, in some cases, wget will return a 400 error, and the artisan commands will not run. If this happens, you can simply run wget --spider with your URL and UPDATE_SECRET string, or visit that same URL in your browser and it will go through on the second attempt. If you have to do that, I suggest removing UPDATE_SECRET from your .env file for now. This issue happens to me whether I’m attempting to trigger the commands with wget, curl, or any browser. Unfortunately, nobody else has reported the same issue, so I’m at a loss as to what could be going on.

Finally, if you still prefer the old version, 4.6.3 of the script has moved to

That’s amazing!! Thanks for your continued work on the script!

Happy to help out!

Hopefully someone else encounters the issues with using UPDATE_SECRET to help figure out what the heck is going on, heh.

Minor revision. Added a 15 second timeout to the first wget commend, so if is down for whatever reason (like it was today, apparently), it’s not stuck in a wait state for the default 900 seconds.

Just used this today to successfully update my installation, very useful. Thanks for your work on the script.

Works well on Invoice Ninja 4.4.4.

Just had to carry out some prerequisites. In summary for others, even though this information is available in other posts on this forum:

  1. wget/ftp update script to /usr/local/bin directory
  2. change permissions: sudo chmod 755
  3. install locate as detailed in Titanfail’s post: sudo apt install locate
  4. install dos2unix to remove possible line returns: sudo apt install dos2unix
  5. remove line returns: sudo dos2unix
  6. run the script: sudo

Thanks very much for this scipt for this script Titanfail. Be nice if there was a button in Invoice Ninja self hosted to run this script with some GUI feedback, but I guess that would mean having some self-hosted specific code.

“Be nice if there was a button in Invoice Ninja self hosted to run this script with some GUI feedback, but I guess that would mean having some self-hosted specific code.”

It probably could be added, but that’s out of the scope Hillel and the team are focusing on, and I’m not about to put in a pull request because that’s way out of my depth, lol. But between my solution, Docker images, and Ansible, it seems there’s an option to fit everyone. Such is the beauty of open source.

As for getting all the information on how to use the script into an easy-to-use format, I plan on making a short howto video whenever I get some time to do it (plus the VO for it would be a nice portfolio piece for me).

Thanks for Automatic Update Script!

Thanks again Titanfail - just upgraded to 4.5.12 from 4.4 and all appears to have worked well.