I have a program (call it x, written in c++) which will run using a job scheduler to spawn instances of x to process work units sent from a server.
Part of the processing x does is to split the work into multiple smaller units which it processes in a queue. I would like to use redis to manage the queue for x, but everytime x starts, I want it to connect to a new instance of redis so that I can restart x with the partially processed results if something goes wrong.
What is the best way to achive this? Can I create a new redis instance programmatically (like SQL CE), or must I spawn new instances of redis via the shell?
This is still “via the shell”, but from within your program: you could
fork–exec, usepopen, orsystem(with a&at the end) to interact with a shell to execute Redis.