Any way to programmatically restart Lucee

Anyone have ay suggestions on how the best way to restart lucee from lucce, Or reboot server from lucee?

Thanks.

See how it’s done in the Admin:

Much thanks!

thank you for this info.

I did run this code successfully. But not sure if it actually restarted the server. Running a cfthread, and when this code executed it does not terminate the thread. Whereas if I do a ./shutdown.sh and a ./startup.sh it would kill it.

this what I came up with to reboot the whole server. It can apply it to other scripts as well. If you know why cfadmin doesn’t kill existing threads I’d like to know why.

// dev on osx 
runtime = CreateObject( "java", "java.lang.Runtime", ExpandPath( "." ) );
process_runtime = runtime.getRuntime();
command = "sudo -S <<< 'YOURPASSWORD' shutdown -r now";
process_exec = process_runtime.exec( javacast( "string[]", ["/bin/bash", "-c", command ]) );

1 Like