I am using upstart instance jobs to start few of my services. The jobs are meant to have one instance per user i.e they take in the user name as the instance parameter. I have also configured them to be respawned by upstart. The respawning works. Here is what my config file looks like
start on runlevel  stop on runlevel  normal exit 0 respawn respawn limit 5 300 instance $user chdir /home/talha/syncservice/ script exec python sync.py $user end script
The issue is that I want these instance jobs to be restarted on system reboot. Obviously I cannot pass in all the usernames as the instance parameters on reboot as I do not know what and how many instances were spawned last time.
Is there a way that upstart can persist its state tables for instance jobs across reboots. Why I assume that there are some "state table"?, is because I assume that upstart keeps a track of all the running instance jobs. There would be a state table that tracks which instance to respawn when it crashes. Otherwise it wont be able to respawn an instance job. So if those tables can be made persistent across reboots my problem will be solved.
Can the persistence be somehow achieved.? Where does upstart keep the track of its running jobs? Is it only in memory or a file?
If that cannot be done, that means that the stanza
start on runlevel
has no meaning or benefit for instance jobs.