Scheduled task for C++ EXE not working [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I've bought a VPS, but it has been restarting on occasion. The server is meant to be running my game server 24/7, but when it restarts obviously the game goes down too.
I'm trying to setup a scheduled task to run the C++ game server EXE on start up, but it isn't working. I've already set a scheduled task to run WAMP so I know that the scheduled tasks actually work, but for the C++ EXE it just isn't.
I've even compiled a very simple program that just waits for user input before closing, and set this as a scheduled task. When I restart the server, this program doesn't even run.
Any ideas? Is this a problem specific to running an executable like this?
It's also strange, on the scheduled task manager it says the program is running, but no console is on screen...
OS: Windows Server 2003

Since you are using Windows Server 2003, check out here to allow services to interact with desktop.

Related

C++ app - how to stop/cleanup if it is run as Linux service? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
I have basically a console C++ app for Linux CentOS9. I am going to run it as a service using systemctl start/stop.
Currently the app exits if user press Enter in the console but this wont be possible in service mode as the user wont see the app console after logging in.
What can be done so I the app can detect it is being stopped/terminated so it can cleanup resources (closing files)?
It seems systemctl stop sends SIGTERM.
Just register callback for it
void signal_callback()
{
printf("Process is going down\n");
}
signal(SIGTERM, signal_callback)
How systemd stop command actually works

Developing an application to restart another application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I need to write an application which will be installed inside a windows7 embedded enterprise O/S. This applications job is to restart another application at a pre-configured time each day. Can you please tell me which API's do i need to refer for this purpose? Do i need to depend on the windows scheduler for this task? Is it possible to configure the scheduler from win32 code?
Is there any application which does this job already exist in the market?
Thanks,
John.
I would use a Task Scheduler which is good documented and has many examples.
Take a look at Time Trigger Example:
This C++ example shows how to create a task that is scheduled to
execute Notepad at a specified time. The task contains a time-based
trigger that specifies a start boundary and an end boundary for the
task. The task also contains an action that specifies the task to
execute Notepad. The task is registered using an interactive logon
type, which means the task runs under the security context of the user
who runs the application. The task also contains idle settings, which
specifies how Task Scheduler performs tasks when the computer is in an
idle condition.
You can do this from a batch file.
First, prepare a script, e.g. "restart.bat" to kill the process and restart it, killing can be done by taskkill, restarting should be done by start to not block current script.
Then create setup batch file to add "restart.bat" to task scheduler
You can get (or specify as a string) the PID from EnumProcesses, kill the process using TerminateProcess() and then later you can create process by OpenProcess() function from Win32.
Another approach is that you can also use ShellExecute() or system to executed commandline commands directely from a Visual C++ program, and pass a command as:
taskkill /F /T /IM MyProcess.exe
later simply open the application using ShellExecute or system.

configure wamp server [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I installed wamp server2 in windows7 64 bit. after installing when I start wampserver it goes offline. and all the components like localhost, apache does not work.when I try to put it online it shows 'Could not execute menu item(internal error)[exception].Could not perform service action' message as error . when I run wamp as admin it goes online but still the localhost does not work. what can I do to make it work.
It could be a conflict with Skype...
If you have Skype, go in skype advance options and check use alternative port. (Can't remember exactly what is the option but it will make skype use another port and solve the conflict)

How to test internet application at local computer (windows-7)? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
This application sends data periodically to a server. What I need to do is setup a testing environment on the local developing machine so that I can check the correct packets are being sent in each situation. I thought a good approach would be a server VM set up on the local computer which would receive the packets and respond just like the real thing, but the problem is how do I route the packets of an application running on windows to a VM machine. I don't want to modify my application code. I just want to have windows pass on the packets it receives from the application to the VM or otherwise another application that will do the testing. Is this possible? If not, please let me know about any other solution(s) to this problem.
If you're running a decent VM you should be able to give it an IP address visible from the host, and configure it so that you can run web servers on it, ssh to it, etc.
Look at the networking features of your VM. Or find a tutorial on how to do this, such as this one for VirtualBox:
http://www.tolaris.com/2009/03/05/using-host-networking-and-nat-with-virtualbox/
Well it's some kind of a hack but you can use ARP Poisoning (man in the middle attack) to sniff packets. There is a tool named Cain & Abel which can do this for you. I've used this tool to sniff packets between two non-pc machines. Use at your own risk and if your anti-virus tool alerts, know that the tool has no virus but what it does is detected as one.
Edit: Please note that my approach doesn't require a VM server.

Has anyone used Facebook Scribe? (the tool for logging everything) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How does it work? (Explain it in terms of server, writes, GETs, values, whatever).
DOes it work with Win32 apps?
I'll try to explain:
There is an application, with thrift
class/interface. When event that you
want to log occures, you send
message to the
Server, which collect logs from many
sources (application, server logs,
etc)
And then server decides what do
do with it: generate visualization,
send over tcp/ip, store in a file,
nfs, hdfs, you decide.
Server and client can be the same
app or machine, or this log data can
be sent from client over internet.
Definitely works with win32 apps.
It Works Great.
We're using Scribe to test some message processing.
We're sending Apache logs with Scribe. (Under Ubuntu)