Install newlisp script into Windows Service

Source: Internet
Author: User

Now there is a requirement to make a newlisp script file into a Windows Service and start it automatically upon startup. Check the system environment and whether other processes are still running.

To run newlisp on Windows, you need to execute a command similar to this:

newlisp a.lsp

Therefore, write a BAT file to execute the above command. In this way, the problem is converted to how to install the BAT file into a Windows Service. The following is a detailed example.

Assume there is a daemon. LSP file with the following content:

(while true       (println "hello, I am daemon")       (append-file "c:\\t.txt" "mm")       (sleep 1000))

Write "mm" to the file c: \ t.txt every 1000 ms"

Write another daemon. BAT file with the following content:

newlisp C:\windows_service\daemon.lsp

Make sure that the absolute path is used to ensure that no error occurs when running Windows service.

Now download the nnsm program: http://nssm.cc/download? Page = download

After decompression, select a 32-or 64-bit program based on the platform and copy it to the Windows/system32/directory.

Run the following command:

nssm install my_daemon C:\windows_service\daemon.bat

The installation is successful.

Run the following command when starting:

net start my_daemon

Nssm.exe cannot be deleted or moved.

It is easy to uninstall Windows service.

nssm remove my_daemon confirm

Done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.