Tutorial

FiveM ensure vs start vs restart Explained

What the FiveM console commands refresh, start, stop, restart and ensure really do, when to use each, and how server.cfg start order works.

By ALN DEV · · 1 min read

FiveM has several commands that seem to do the same thing. They do not, and using the wrong one is a classic source of confusing bugs. Here is what each one does and when to use it.

The commands

  • `refresh`: rescans the resources folder so the server knows about new or changed resources. It does not start anything.
  • `start name`: starts a resource that is not running.
  • `stop name`: stops a running resource.
  • `restart name`: stops and starts a resource that is already running.
  • `ensure name`: starts the resource if it is stopped and restarts it if it is already running.

Which one to use

For day-to-day work, ensure is the safest choice because it does the right thing in both cases. After adding a brand new script folder, run refresh first and then ensure:

refresh
ensure my-script

Start order in server.cfg

On boot, resources start in the order they appear in server.cfg. A script that needs oxmysql, a library or your framework must come after them:

ensure oxmysql
ensure ox_lib
ensure qb-core        # or es_extended / qbx_core
ensure my-script

Restarting a dependency

Restarting a framework or library while the server is live can break every resource that relies on it. Prefer restarting the single resource you changed, and do bigger restarts when players are offline.

Common mistakes

  • Adding a folder and running ensure without refresh, so the resource is not found.
  • Putting the script above its dependencies in server.cfg.
  • Restarting a resource and expecting config changes to apply in a script that caches them at start. Restart the exact resource that owns the config.

If a resource still will not run, use the script troubleshooting checklist. New to the console? Read the txAdmin setup guide and how to install a FiveM script.