how do i make my Go program supervised by some kind of systemd in linux, the requirement are :
restart on crash
start on boot
and my Go Program also has Administrator access (via manifest file), so is there any way to do that ?
For your first question, you could consider using a library like https://github.com/kardianos/service
Related
I'm writing a Python 3 program in Windows and I would like to be able to continue running the program in the background (not in the taskbar) to gather information.
I was able to create it as a service, but I need admin privileges to run and it stops immediately!
It sounds to me like what you want is to make your program a Windows service. There's a bunch of good information in this other question: Is it possible to run a Python script as a service in Windows? If possible, how?
I need to write a program that monitors a directory and raises an event when a file is added to the directory. This task needs to run all the time. I know how to use FileSystemWatcher to implement the task itself, but I don't know how this program that I'll be writing can run all the time. What sort of project template in Vistual Studio should I use to create this program and how I can run this program all the time? Thank you for the help.
Not sure which version of Visual Studio you are using. Choose the Project Template "Windows Service". Windows service is a computer program that operates in the background similar to Unix Daemons.
I have very basic question, How to simulate windows service crush,
I found a way how to set the rules of a service to restart himself in case of failure,
Now I just want to check it,
I don't want to add code to my projects (I have 3) to simulate the crush, I prefer to simulate it from external,
I prefer so generic solution.
Thanks.
Possibilities:
manually locate the .exe of the service in Task Manager and terminate it
programmatically locate the service process and use the WINAPI TerminateProcess()
I am porting an application which runs as a background service in windows at startup, we are porting the application to linux(SUSE Enterprise server), I'am completely new to linux. Can somebody help me on how to proceed with this. Like
Should I build the linux executable
After builiding the binary, what changes should I make to linux startup files to run this executable
How my service can register call back function to modify or change or send commands to my service while it is running
Yes, you should build a Linux binary. You may want to rephrase your question since I doubt this is the answer you want :-)
You should generally create what is known as an "init" file, which lives in /etc/init.d. Novell has a guide online which you can use to author the file. Note that while the init file is common, the exact method of letting the operating system use it varies depending on the distribution.
This is going to be a marked change for you. If you are doing simple actions such as re-loading a configuration file, you can use the signals functionality, especially the SIGHUP/HUP signal which is generally used for this purpose. If you require extended communication with your daemon, you can use a UNIX domain socket (think of it as a named pipe) or a network socket.
Another task you are going to need to accomplish is to daemonize your application. Generally this is done by first fork()ing your process, then redirecting the stdin/stdout pipes in the child. There are more details which can be answered by reading this document
See how-to-migrate-a-net-windows-service-application-to-linux-using-mono.
Under Linux, deamons are simple background processes. No special control methods (e.g start(), stop()) are used as in Windows. Build your service as a simple (console) application, and run it in the background. You can use a tool like daemonize to run a program as a Unix daemon.
I guess it is impossible, but I will ask it anyway. I have a Windows application that executes BeginUpdateResource / UpdateResource / EndUpdateResource
Can I somehow execute this on Linux/Unix? Its server-side, so no GUI emulator could be running.
I am not sure exactly what can be achieved with Wine, but that might be a way to go if you have the source code for the application you want to run. See also Will Wine run only under X, or can it run in character mode?.
Another alternative is to re-write the functionality.
I would not recommend it unless you are using Wine which is not an emulator but a re-implementation/binding of the Win32 API on Linux and a handler for Windows executables.
If you want to do things like this, port your application to C#/.NET and use the Mono runtime on the Linux system..
In short, dont