Search code examples
javamacosunixderby

How to run derby process "startNetworkServer" in background on mac


I just migrated from Windows OS to MAC OSX El Capitan. In Windows I had idea how to run any .bat file as windows service on startup of system. Please help me how to achieve the same in the mac so that on startup of mac system "startNetworkServer" derby unix executable should be started automatically in background.


Solution

  • You can use the nohup unix command in conjunction with the & to run processes in background.

    Type this in your macOS Terminal:

    nohup startNetworkServer &
    

    This should start your network server in the background and you should be able to exit the terminal also.

    Update

    Wrap the above command in a shell script.

    You can then use the built in utility launchd to configure the script to run at startup.


    An alternate option would be to add the script to the user's Login Items under System Preferences > Users & Groups > Select the User > Login Items

    Hope this helps!